Main Page
Chat
PHP tests
Games
Jokes
Unicorn Archives
Discussion Boards
Favorite Links
Programming
Personal Archives
Affiliates
Guest Book
Feedback Form
Transfer (MODs)
IP.s:
IP.c: 38.103.63.59
Last update:
Nov 06 2006
#!/usr/bin/perl BEGIN {open (STDERR, ">error.txt");} $|=1; ## Don't buffer output ################################################# # thanks to Lincoln Stein for creation of CGI.pm # ################################################# use CGI qw/:standard/; # MAIN Loop &getCookies(); &getParams(); &initalize(); &getTicket(); if(!$myCash) { $myCash = 10000;} print header; print start_html("$company\'s $progName $version $ver_date"); print "$bdy
"; print "

$company\'s $progName $version

"; if($ticket[1] == 0) { &errors('zeroTicket'); &formBottom(); exit 0;} if($showPaytable) { &showPaymentTable(); &formBottom(); exit 0;} &checkLowestPay(); &checkBonus(); &checkThree(); &calcCash(); if ( ($bonusFound > 0) && ($payTable[$bonusSprite] eq "BONUSROUND") ) { &playBonus; &formBottom(); exit 0;} &drawBoard(); print end_html; exit 0; # subs sub getCookies { $cdata = $ENV{'HTTP_COOKIE'}; @pairs = split(/~/, $cdata); foreach $pair (@pairs) { $pair{$pair} = $pair; $Data[$i] = $pair; $i += 1; #print "$pair{$pair}
"; } if(($Data[1]) && ($Data[1] ne "foo")){ $bdy = ""; } else{ $bdy = ""; } return; } sub getParams { $myCheckbox = param('myCheckbox'); $showPaytable = param('showPaytable'); $myCash = param('cash'); } sub initalize { # The following will be in an INIT file for the game being played it could also be crypted or saved as binary... #$ipnum = $ENV{'REMOTE_ADDR'}; $company = "Bifrost Production"; $progName = "One Armed Bandets"; $version = "v1.05"; $ver_date = "07-23-02"; $returnDir = "/games/"; $imgDir = "/images/oab"; @sprite = ("$imgDir/0.jpg","$imgDir/1.jpg","$imgDir/2.jpg","$imgDir/3.jpg","$imgDir/4.jpg","$imgDir/5.jpg","$imgDir/6.jpg","$imgDir/7.jpg","$imgDir/8.jpg","$imgDir/9.jpg"); @ticket = (0,0,0,0,0,0,0,0,0,0); @tripples = ("", "", "", "", "", "", "", "", "", ""); @tripInfo = ("foo","Row 1","Row 2","Row 3","Col 1","Col 2","Col 3","\\","\/"); @payTable = (0,1,25,2,4,5,5,10,70,150); $arrayLength = 9; $lowSprite = 1; $lowSpriteInfo = "(\"ones\")"; $low1SpritePay = 1; $low2SpritePay = 3; $low3SpritePay = 5; $bonusSprite = 2; $bonusSpriteInfo = "Bonus (\"twos\")"; $width = 100; # Width of the symbols $height = 100; # Height of the symbols $winWidth = $width/4; $winHeight = $height/4; $payWidth = $width/2; $payHeight = $height/2; $topGraphic = "$imgDir/top.jpg"; $bottomGraphic = "$imgDir/bottom.jpg"; $sideGraphic1 = "$imgDir/side.jpg"; $sideGraphic2 = "$imgDir/side2.jpg"; $sideGraphic3 = "$imgDir/side.jpg"; $sideGraphic4 = "$imgDir/side2.jpg"; $sideGraphic5 = "$imgDir/side.jpg"; $sideGraphic6 = "$imgDir/side2.jpg"; $totalPaid =0; } sub getTicket { for($i=0;$i<($arrayLength+1);$i++){ $myNum = (int rand $arrayLength) + 1; $ticket[$i-1] = $myNum; } #for($i=0;$i<($arrayLength+1);$i++){ $ticket[$i-1] = $lowSprite;} #$ticket[1] = $lowSprite; $ticket[2] = $lowSprite; $ticket[3] = $lowSprite; #$ticket[7] = $bonusSprite; $ticket[8] = $bonusSprite; $ticket[9] = $bonusSprite; #$ticket[1] = 4; $ticket[2] = 4; $ticket[3] = 4; #$ticket[4] = 7; $ticket[5] = 7; $ticket[6] = 7; #$ticket[7] = 9; $ticket[8] = 9; $ticket[9] = 9; } sub drawBoard { # Parameter input check if ($myCheckbox) { &woohoo();} elsif ($myError eq "WOOPERNARFLES") { &errors('1');} else { &noParam();} print "


"; print ""; print ""; print ""; print ""; print "
"; # END print ""; print ""; print ""; print ""; print "
"; # END print ""; print ""; print ""; print ""; print "
"; # END print "
"; if ($totalPaid > 0) { print "Round Winnings = $totalPaid
";} print "Total Credits $myCash
"; &formBottom(); if ($totalLowest > 0) { print "Total single $lowSpriteInfo found = $totalLowest
";} if ($lowestDoubles > 0) { print "Total double $lowSpriteInfo found = $lowestDoubles
";} if ($lowestTriples > 0) { print "Total triple $lowSpriteInfo found = $lowestTriples
";} if ($bonusFound > 0) { print "Total $bonusSpriteInfo found = $bonusFound
";} $tempCount = 0; print "

"; foreach $tripFound (@tripples) { if ( $tripFound ne "") { print ""; } $tempCount++; } print "
in $tripInfo[$tempCount]
"; print "
Return to Games Directory
"; print "
"; } sub copyPre { return; } sub woohoo { print "you checked it...*GHASP*...oh the horror...
"; print "*insane laughter*
";; } sub noParam { print "No Parameters"; } sub formBottom { print start_multipart_form(); #print ""; #print "
      "; print ""; print "Show Paytable   "; print "My Checkbox   "; #print ""; #print "

"; print submit(-label=>'Do it :)'); print end_form; } sub calcCash () { $totalPaid = ($payTable[$lowSprite] * $low1SpritePay * $totalLowest); $totalPaid += ($payTable[$lowSprite] * $low2SpritePay * $lowestDoubles); $totalPaid += ($payTable[$lowSprite] * $low3SpritePay * $lowestTriples); if ($payTable[$bonusSprite] ne "BONUSROUND") { $totalPaid += ($payTable[$bonusSprite] * $bonusFound);} $tempCount = 0; foreach $tripFound (@tripples) { if ( $tripFound ne "") { $totalPaid += $payTable[$tripFound];} $tempCount++; } $myCash = $myCash + $totalPaid - 1; } sub mySort() { @getVars = @_; $sortString = ""; foreach $myTemp (@getVars){ $sortString = "$sortString$myTemp~";} return($sortString); } sub playBonus() { print "BONUS Round :)..."; } sub checkLowestPay { $lowestTriples = 0; $lowestDoubles = 0; $totalLowest = 0; ######################### # Find Singles # ######################### for($i=1;$i<($arrayLength+1);$i++){ if($ticket[$i] eq $lowSprite){ $totalLowest++;} } ######################### # Find Doubles # ######################### if(($ticket[1] eq $ticket[2]) && ($ticket[1] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Row 1 if(($ticket[2] eq $ticket[3]) && ($ticket[2] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Row 1 if(($ticket[4] eq $ticket[5]) && ($ticket[4] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Row 2 if(($ticket[5] eq $ticket[6]) && ($ticket[5] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Row 2 if(($ticket[7] eq $ticket[8]) && ($ticket[7] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Row 3 if(($ticket[8] eq $ticket[9]) && ($ticket[8] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Row 3 if(($ticket[1] eq $ticket[4]) && ($ticket[1] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Col 1 if(($ticket[4] eq $ticket[7]) && ($ticket[4] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Col 1 if(($ticket[2] eq $ticket[5]) && ($ticket[2] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Col 2 if(($ticket[5] eq $ticket[8]) && ($ticket[5] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Col 2 if(($ticket[3] eq $ticket[6]) && ($ticket[3] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Col 3 if(($ticket[6] eq $ticket[9]) && ($ticket[6] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Col 3 if(($ticket[1] eq $ticket[5]) && ($ticket[1] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # LDiag if(($ticket[5] eq $ticket[9]) && ($ticket[5] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # LDiag if(($ticket[3] eq $ticket[5]) && ($ticket[3] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # RDiag if(($ticket[5] eq $ticket[7]) && ($ticket[5] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # RDiag if(($ticket[1] eq $ticket[3]) && ($ticket[1] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Row 1 if(($ticket[1] eq $ticket[7]) && ($ticket[1] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Col 1 if(($ticket[1] eq $ticket[9]) && ($ticket[1] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # LDiag if(($ticket[3] eq $ticket[7]) && ($ticket[3] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # RDiag if(($ticket[4] eq $ticket[6]) && ($ticket[4] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Row 2 if(($ticket[2] eq $ticket[8]) && ($ticket[2] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Col 2 if(($ticket[7] eq $ticket[9]) && ($ticket[7] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Row 3 if(($ticket[3] eq $ticket[9]) && ($ticket[3] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # Col 3 #if(($ticket[2] eq $ticket[4]) && ($ticket[2] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # ULMiddleDiag #if(($ticket[2] eq $ticket[6]) && ($ticket[2] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # URMiddleDiag #if(($ticket[4] eq $ticket[8]) && ($ticket[4] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # LLMiddleDiag #if(($ticket[6] eq $ticket[8]) && ($ticket[6] eq $lowSprite)) { $lowestDoubles++; $totalLowest=$totalLowest-2;} # LRMiddleDiag ######################### # Find Tripples # ######################### if(($ticket[1] eq $ticket[2]) && ($ticket[2] eq $ticket[3]) && ($ticket[1] eq $lowSprite)){ $lowestTriples++; $lowestDoubles = $lowestDoubles - 3; $totalLowest = $totalLowest + 3;} if(($ticket[4] eq $ticket[5]) && ($ticket[5] eq $ticket[6]) && ($ticket[4] eq $lowSprite)){ $lowestTriples++; $lowestDoubles = $lowestDoubles - 3; $totalLowest = $totalLowest + 3;} if(($ticket[7] eq $ticket[8]) && ($ticket[8] eq $ticket[9]) && ($ticket[7] eq $lowSprite)){ $lowestTriples++; $lowestDoubles = $lowestDoubles - 3; $totalLowest = $totalLowest + 3;} if(($ticket[1] eq $ticket[4]) && ($ticket[4] eq $ticket[7]) && ($ticket[1] eq $lowSprite)){ $lowestTriples++; $lowestDoubles = $lowestDoubles - 3; $totalLowest = $totalLowest + 3;} if(($ticket[2] eq $ticket[5]) && ($ticket[5] eq $ticket[8]) && ($ticket[2] eq $lowSprite)){ $lowestTriples++; $lowestDoubles = $lowestDoubles - 3; $totalLowest = $totalLowest + 3;} if(($ticket[3] eq $ticket[6]) && ($ticket[6] eq $ticket[9]) && ($ticket[3] eq $lowSprite)){ $lowestTriples++; $lowestDoubles = $lowestDoubles - 3; $totalLowest = $totalLowest + 3;} if(($ticket[1] eq $ticket[5]) && ($ticket[5] eq $ticket[9]) && ($ticket[1] eq $lowSprite)){ $lowestTriples++; $lowestDoubles = $lowestDoubles - 3; $totalLowest = $totalLowest + 3;} if(($ticket[3] eq $ticket[5]) && ($ticket[5] eq $ticket[7]) && ($ticket[3] eq $lowSprite)){ $lowestTriples++; $lowestDoubles = $lowestDoubles - 3; $totalLowest = $totalLowest + 3;} if($totalLowest < 0) { $totalLowest = 0;} if($lowestDoubles < 0) { $lowestDoubles = 0;} return; } sub checkBonus { $bonusFound = 0; for($i=1;$i<($arrayLength+1);$i++){ if($ticket[$i] eq $bonusSprite){ $bonusFound++;} } } sub checkThree { # Counts made in order # @tripples = ("", "", "", "", "", "", "", "", "", "") <-- Replace 1-9 with symbol received if( ($ticket[1] eq $ticket[2]) && ($ticket[2] eq $ticket[3]) && ($ticket[1] ne $lowSprite) ){ $tripples[1] = $ticket[1]; if ($ticket[1] eq $bonusSprite) { $bonusFound = $bonusFound - 3}} # Row 1 if( ($ticket[4] eq $ticket[5]) && ($ticket[5] eq $ticket[6]) && ($ticket[4] ne $lowSprite) ){ $tripples[2] = $ticket[4]; if ($ticket[4] eq $bonusSprite) { $bonusFound = $bonusFound - 3}} # Row 2 if( ($ticket[7] eq $ticket[8]) && ($ticket[8] eq $ticket[9]) && ($ticket[7] ne $lowSprite) ){ $tripples[3] = $ticket[7]; if ($ticket[7] eq $bonusSprite) { $bonusFound = $bonusFound - 3}} # Row 3 if( ($ticket[1] eq $ticket[4]) && ($ticket[4] eq $ticket[7]) && ($ticket[1] ne $lowSprite) ){ $tripples[4] = $ticket[1]; if ($ticket[1] eq $bonusSprite) { $bonusFound = $bonusFound - 3}} # Col 1 if( ($ticket[2] eq $ticket[5]) && ($ticket[5] eq $ticket[8]) && ($ticket[2] ne $lowSprite) ){ $tripples[5] = $ticket[2]; if ($ticket[2] eq $bonusSprite) { $bonusFound = $bonusFound - 3}} # Col 2 if( ($ticket[3] eq $ticket[6]) && ($ticket[6] eq $ticket[9]) && ($ticket[3] ne $lowSprite) ){ $tripples[6] = $ticket[3]; if ($ticket[3] eq $bonusSprite) { $bonusFound = $bonusFound - 3}} # Col 3 if( ($ticket[1] eq $ticket[5]) && ($ticket[5] eq $ticket[9]) && ($ticket[1] ne $lowSprite) ){ $tripples[7] = $ticket[1]; if ($ticket[1] eq $bonusSprite) { $bonusFound = $bonusFound - 3}} # \\ if( ($ticket[3] eq $ticket[5]) && ($ticket[5] eq $ticket[7]) && ($ticket[3] ne $lowSprite) ){ $tripples[8] = $ticket[3]; if ($ticket[3] eq $bonusSprite) { $bonusFound = $bonusFound - 3}} # / return; } sub parceName { $wooper = $_[0]; $offset = 1; $bump = 0; while (($bump != 1) && ($wooper ne "") ) { $tmpString = substr ($wooper, -$offset, 1); if ($tmpString eq ".") { $bump = 1;} else { $offset++;} $retName = substr ($wooper, -$offset-1, 1 ); } return($retName); } sub getLastOfPath { $passVar = $_[0]; $count= 0; $offset = 1; $blk = 0; $tmpString = ""; $tempX = "\/"; $passVar =~ s/\\/\//g; # convert Win/Dos to UNIX $passVar =~ s/:/\//g; # convert Mac to UNIX while ($blk != 1) { $tmpString = substr ($passVar, -$offset, 1); if ($tmpString eq $tempX) { $blk =1;} else { $offset++;} $count++; if ($count > 300) { $blk =1;} } $start = ($offset-1); $retName = substr ($passVar, -$start, $start ); return ($retName); } sub showPaymentTable { $pay1Low = $payTable[$lowSprite] * $low1SpritePay; $pay2Low = $payTable[$lowSprite] * $low2SpritePay; $pay3Low = $payTable[$lowSprite] * $low3SpritePay; print "

"; print ""; print ""; print ""; print ""; print ""; print ""; $tempCount = 0; foreach $tripFound (@payTable) { if ( ($tempCount !=$lowSprite) && ($tempCount !=$bonusSprite) && ($tempCount !=0) ) { print ""; } $tempCount++; } print "
Pay Table Data...
 SymbolCredits
Single$pay1Low
Double$pay2Low
Tripple$pay3Low
Bonus
Symbol
$payTable[$bonusSprite]
Tripple$payTable[$tempCount]
"; } sub errors { $error = $_[0]; if ($error eq '1') { print "

Error WOOPERNARFLES ;)..."; } if ($error eq 'zeroTicket') { print "

Ticket Error...

"; print "I'm sorry; however there was an error reading the ticket :("; } if ($error eq '3') { print "

Error 3 ;)..."; } if ($error eq '4') { print "

Error 4 ;)..."; } if ($error eq '5') { print "

Error 5 ;)..."; } }