## "The Coffee Game" ## Wrighten by Rodney Broom $Cheater = 0; # Set this to 1 to turn on cheating. print "\n\n"; print "*****************************************************************\n"; print "******* This is the Coffee game, ******\n"; print "******* Where you get to guess a number between 1 and 100. ******\n"; print "*****************************************************************\n"; print "\n\n\n"; print "\t***********************************************\n"; print "\t******* Enter the start of the range: *******\n"; print "\t***********************************************\n"; print "\nStart>"; chop ($Range_start = ); print "\n\n"; print "\t***********************************************\n"; print "\t******* Enter the end of the range: *********\n"; print "\t***********************************************\n"; print "\nEnding>"; $Range_end = ; chop ($Range_end); Generator(); until ($Random >= $Range_start && $Random <= $Range_end) { Generator (); } if ($Cheater) {print "Cheat: the number is [$Random].\n\n";} print "\nI have the number for you to guess,\n"; Top: print "\nPlease make your entry>"; chop ($Entry = ); if ($Entry < $Random) { print "Too low, guess again.\n"; goto (Top); } elsif ($Entry > $Random) { print "Too high, guess again.\n"; goto (Top); } elsif ($Entry == $Random) { print "You win!\n"; } else { print "Wow, invalid entry. Try numbers.\n"; goto (Top); } print "\n\$Random = $Random\n"; sub Generator { srand (time()); $Random = int (100 * rand ()); }