Help for this page

Select Code to Download


  1. or download this
    my %offset = ('n' => [0, 1], 's' => [0, -1], 'e' => [1, 0], 'w' => [-1
    +, 0]);
    
  2. or download this
    my $new_x = $old_x + $offset{$direction}[0];
    my $new_y = $old_y + $offset{$direction}[1];