Last active
November 1, 2020 23:14
-
-
Save thunderpoot/73ad56b96d5c5b5544fdee528bcbd801 to your computer and use it in GitHub Desktop.
In response to some Python someone posted somewhere
This file contains hidden or 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 | |
use strict; | |
use warnings; | |
use Time::HiRes 'usleep'; | |
$|++; # force auto-flush (see perldoc perlvar) | |
my $distance = 1 + int(rand(49)); | |
my @stones = ("_","-"); | |
print( "\e[?25l" ); # hide cursor | |
for ( my $i = 1; $i < $distance; $i++ ) | |
{ | |
print( "\e[" . sprintf ( $i * 2 + 1 ) . "D " ); | |
print( " " x $i ); | |
print( $stones[ rand @stones ] ); | |
usleep(90000); | |
} | |
print( "\e[D'splash!'\n" ); | |
print( "\%You scored: $distance\n" ); | |
print( "\e[?25h" ); # show cursor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment