---------0000000000111111111
9876543210123456789012345678
-8 . . . - - -8
-7 . . . . - ^ -7
-6 . . . . - - - - -6
-5 . . - . a a - ^ ? ? - -5
-4 . . . . k o ! - ^ ? ? ? -4
-3 . - . a h j a ^ ^ ^ ^ ^ - -3
-2 . . - . a a a ^ a a - - - -2
-1 . . . a a a b + + ^ ^ - -1
0 . . . m c u a a - ^ - ^ 0
1 . - . a a . a a - - ^ 1
2 - ^ ^ a a a ^ a - - ^ 2
3 - - - - - - - . . - 3
4 ^ - - - - - ^ - - 4
5 - ^ - - ^ - - - 5
---------0000000000111111111
9876543210123456789012345678
(From the docs for the map command)
To move east or west you use an increment of two to the x index (i.e. west would be ( x - 2, y )); north / south is forbidden in this scheme since the faces are lined up W/NW/NE/E/SE/SW, although that's by convention and there's nothing saying you couldn't rule out east / west by adding to y instead (and in effect rotating the hex grid 90 degrees). To move any of the other four directions you add/subtract one to both coordinates (northeast would be ( x + 1, y - 1)). You can easily verify if a coordinate pair's valid as both x and y have to be both odd or both even.
If this is anywhere near what you were asking about you might take a gander at PEI, the Perl Empire Interface, which has code for dealing with maps of this type.
|