3 ms·
Just out of curiosity, could you provide a link to a simple game written in ~10 (ten!) lines of code? My understanding was that for anything close to interactiv
by AlexCyrlex 14y ago
Just out of curiosity, could you provide a link to a simple game written in ~10 (ten!) lines of code? My understanding was that for anything close to interactive game at least 50-100 lines of code are needed: to draw something, make it move and react to user input in a meaningful way.
I am not familiar with frameworks such as Scratch or pygame; still 10 lines of code look like too few for a game.
- lsiebert 14y agoYou can do a simple terminal program in 10 lines. 10 commands probably not, but this is still fairly readable. in perl, a simple guessing game that runs in linux/unix #!/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";}