in reply to sloooowwwwww code!
Here's a little tip to get you going:
this piece of untested code would save you 40 lines of code. Not bad eh? Before thinking of speed, try to see if you can make your code more compact.my @directions = ('w', 'sw', 's', 'se', 'e', 'ne', 'n', 'nw'); my $anchor = $directions[int($real_angle/45 + 0.5)];