14 $map{$x,$y} = $_ eq '#' ? 2 : 0;
21 my $dir = 0; # up right down left
26 my $state = $map{$px,$py};
28 $dir = 3 if --$dir < 0;
29 } elsif ($state == 1) {
31 } elsif ($state == 2) {
32 $dir = 0 if ++$dir > 3;
33 } elsif ($state == 3) {
36 $map{$px,$py} = 0 if ++$map{$px,$py} > 3;