Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/usr/bin/perl
- use strict;
- use Ball;
- my $wojak = new Ball(0,0,["gf"]);
- my %actions = ( "n" => sub { $wojak->{y}++; } , "s" => sub { $wojak->{y}--; } , "w" => sub { $wojak->{x}--; } , "e" => sub { $wojak->{x}++; } , "i" => sub { $wojak->print_inv(); } );
- while ( 1 )
- {
- print "You're in " . $wojak->get_loc() . ". What do? ";
- my $in = <>;
- chomp($in);
- &{$actions{$in}} if $actions{$in};
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement