Created
April 6, 2009 23:29
-
-
Save roberto/91008 to your computer and use it in GitHub Desktop.
typing training
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use Time::HiRes qw(time); | |
use Data::Random::WordList; | |
my $word_list = new Data::Random::WordList(wordlist => '/usr/share/dict/words'); | |
my @targets = $word_list->get_words(5); | |
$start_time = $jam_count = $errors_count = 0; | |
foreach $target (@targets) { | |
do { | |
system('clear'); | |
$errors_count++ ; | |
print $target . "\n"; | |
$start_time = time; | |
} while(<> !~ /^$target$/); | |
$jam_count++ if (time - $start_time) <= 1; | |
$errors_count--; | |
} | |
print "JAM x" . $jam_count . "\n"; | |
print "ERRORS x" . $errors_count . "\n" if $errors_count > 0; | |
$word_list->close(); | |
exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment