by AlexCyrlex · 13y ago · 0 comments
I am not familiar with frameworks such as Scratch or pygame; still 10 lines of code look like too few for a game.
#!/usr/bin/perl $SIG{ALRM} = \×up; my $random_num = int (rand(10)); print "Guess my number (0-9) in less than 10 seconds!\nGuess: "; alarm 10; while(1){ my $guess = <>; if ($guess == $random_num){alarm 0;print "You Got it! Well done!\n"; last; } else { print "Nope; guess again: ";} } sub timesup {die "Uh oh! Time ran out while waiting!\n";}