82 lines
1.5 KiB
Perl
82 lines
1.5 KiB
Perl
#!perl
|
|
|
|
#Scan-foo-game for Revbank - (C)Edwin Eefting (psy0rz)
|
|
|
|
#Released under GPL or whatever revbank uses as license :)
|
|
|
|
use Time::HiRes qw( gettimeofday tv_interval);
|
|
|
|
HELP "game" => "Scan-fu game!";
|
|
|
|
my $fastest=1000;
|
|
my $fastest_name="nobody";
|
|
my $start_time;
|
|
my $step;
|
|
|
|
sub command :Tab(game) {
|
|
|
|
my ($self, $cart, $command) = @_;
|
|
|
|
return NEXT if $command !~ /^(?:game)$/;
|
|
|
|
print "\nWelcome to SCAN-FU \\o/\n";
|
|
|
|
print "\nRecord time is $fastest by $fastest_name\n";
|
|
|
|
$start_time=[gettimeofday];
|
|
$step=1;
|
|
|
|
return "NOW SCAN game_$step", \&step;
|
|
|
|
}
|
|
|
|
|
|
sub step :Tab(whatevah) {
|
|
my ($self, $cart, $input) = @_;
|
|
|
|
if ($step<5)
|
|
{
|
|
if ($input ne "game_$step")
|
|
{
|
|
print "\n\aFAIL! :( *sad trombone*\n";
|
|
|
|
return ACCEPT;
|
|
}
|
|
|
|
$step++;
|
|
|
|
return "NOW SCAN game_$step", \&step;
|
|
}
|
|
else
|
|
{
|
|
|
|
my $elapsed = tv_interval ( $start_time, [gettimeofday]);
|
|
|
|
print "\aCompleted in $elapsed seconds *tadaah*\n";
|
|
|
|
if ($elapsed < $fastest)
|
|
{
|
|
print " #####################\n";
|
|
print " #### NEW RECORD! ####\n";
|
|
print " #####################\n";
|
|
print " You did it in $elapsed !!!\n";
|
|
|
|
$fastest_name="(unknown)";
|
|
$fastest=$elapsed;
|
|
|
|
return "Enter your name for the hall of fame", \&name;
|
|
|
|
}
|
|
|
|
return ACCEPT;
|
|
}
|
|
}
|
|
|
|
sub name :Tab(whatevah) {
|
|
my ($self, $cart, $input) = @_;
|
|
|
|
$fastest_name=$input;
|
|
|
|
return ACCEPT;
|
|
}
|
|
|