in reply to Creating A mini typing game!

For a typing game, it shouldn't take much. Here's an example I kicked out in 30-45 minutes or so:

#!perl use strict; use warnings; use 5.014; use Benchmark; use Carp::Always; use Data::Dumper; use Getopt::Long; $Data::Dumper::Deepcopy = 1; $Data::Dumper::Sortkeys = 1; $| = 1; my $seed = srand(); my $_DEBUG = 0; my $delta = 5; my $dictionary = q{/usr/share/dict/words}; my $level = 1; my $rounds = 2; GetOptions( q{debug!} => \$_DEBUG, q{dictionary|wordlist:s} => \$dictionary, q{level:i} => \$level, q{rounds:i} => \$rounds, q{help} => sub { &help; &help_scoring; exit 0; }, ); if ( $level < 1 ) { $level = 1; } my @words; { open my $inf, q{<}, $dictionary or die $!; while ( my $line = <$inf> ) { chomp $line; push @words, $line; } close $inf; } foreach my $n ( 1 .. $rounds ) { my %btimes; my %to_type; foreach my $i ( 1 .. $delta * $level ) { my $j = int( rand( scalar @words ) ); $to_type{actual}{ $words[$j] }++; $to_type{ci}{ lc $words[$j] }++; } &help_scoring; &help_play; sleep 10; print join( q{ }, keys %{ $to_type{actual} }, ), qq{\n}; $btimes{start} = Benchmark->new; my $line = <STDIN>; $btimes{end} = Benchmark->new; scoring( $line, \%to_type, \%btimes ); print qq{\n} x 3; } sub scoring { my ( $answers, $answer_key, $timing_data ) = @_; $timing_data->{delta} = Benchmark::timediff( $timing_data->{end}, $timing_data->{start} ); my $word_count = scalar( split /\s+/, $answers ); my $character_count = length $answers; print sprintf( qq{Raw data:\n} . qq{\tCharacters: %d\t\tWords: %d\n} . qq{\tCharacters per second: %.3f\tPer minute: %.3f\n} . qq{\tWords per second: %.3f\t\tPer minute: %.3f\n}, $character_count, $word_count, $character_count / $timing_data->{delta}[0], $character_count * 60 / $timing_data->{delta}[0], $word_count / $timing_data->{delta}[0], $word_count * 60 / $timing_data->{delta}[0], ); my $final_score = 0; my $case_incorrect = 0; my @ans = split /\s+/, $answers; foreach my $str (@ans) { if ( defined $answer_key->{actual}{$str} ) { $final_score++; } elsif ( defined $answer_key->{ci}{ lc $str } ) { $final_score++; $case_incorrect++; } } print sprintf qq{Scoring\n} . qq{\tTyped words: %d\t\tRequested words: %d\n} . qq{\tIncorrect case: %d\n} . qq{Final score: %d\n\n}, $word_count, scalar keys %{ $answer_key->{actual} }, $case_incorrect, int( 100 * $final_score / scalar( keys %{ $answer_key->{actual} } ) - $case_incorrect ); } sub help { print qq{$0 [--help] [--debug] [--dictionary=/path/to/word/list] [--level=NN +] [--rounds=NN]\n\n} . qq{\t--help - Display this help\n} . qq{\t--debug - Display debug information\n} . qq{\t--dictionary=/path/to/word/list - Dictionary file to use +(default: /usr/share/dict/words)\n} . qq{\t--level=NN - Game level ( 5 * N words provided )\n} . qq{\t--rounds=NN - Number of rounds to play\n\n}; } sub help_scoring { print qq{Scoring:\n} . qq{\t0-100\n} . qq{\tBase percentage based on number of words successfully typ +ed\n} . qq{\t-1 for case issues\n\n}; } sub help_play { print qq{Please type the following words as quickly as you can while attempt +ing to do so accurately:\n}; }

It doesn't involve a username/password and doesn't keep track of high or previous scores, but it does handle most of the basic parts of a game.

Enjoy the puzzle, and hope that helps (at least stimulate some ideas).