Triangular board representation
-------------------------------
Store as an W*H array, where each position represents a vertex on the board's
triangular divisions. The odd-numbered rows are shifted half a position to the
right of the even-numbered rows, and the rows are spaced so that the resulting
vertex positions actually form equilateral triangles.
Under this arrangement, given a point (x,y) in the array, the actual location
of the vertex is (x + (y%2)/2, y). To avoid confusion, we call the former
"board coordinates" and the latter "actual coordinates".
In board coordinates, the neighbours of any given point (x,y) are:
For even y: (x-1, y-1), (x, y-1)
(x-1, y), (x+1, y)
(x-1, y+1), (x, y+1)
For odd y: (x, y-1), (x+1, y-1)
(x-1, y), (x+1, y)
(x, y+1), (x+1, y+1)
The difference matrix between these two cases is:
[ (1,0) (1,0) ]
DM = [ (0,0) (0,0) ]
[ (1,0) (1,0) ]
I.e., for even y, we use the formulae given above, for odd y, we add DM to
the formulae for even y.
On every vertex in the board, there are 6 cardinal directions, corresponding
to the 6 vertices surrounding it. For convenience, we number them clockwise
starting from the vertex to the upper left. Each cardinal direction
corresponds, obviously, to each of the 6 neighbouring vertices described above.