Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.40 KB | None | 0 0
  1. #/usr/bin/perl
  2. use strict;
  3. use Ball;
  4.  
  5. my $wojak = new Ball(0,0,["gf"]);
  6. my %actions = ( "n" => sub { $wojak->{y}++; } , "s" => sub { $wojak->{y}--; } , "w" => sub { $wojak->{x}--; } , "e" => sub { $wojak->{x}++; } , "i" => sub { $wojak->print_inv(); } );
  7.  
  8. while ( 1 )
  9. {
  10.     print "You're in " . $wojak->get_loc() . ". What do? ";
  11.     my $in = <>;
  12.     chomp($in);
  13.     &{$actions{$in}} if $actions{$in};
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement