-
Notifications
You must be signed in to change notification settings - Fork 12
Hexagonal tiles
Grids based on hexagonal tiles are useful because tiles can have six neighbours,
corresponding to six directions of movement in a game.
UnboundedHexGrid is an infinite, unbounded, grid filled with hexagonal tiles.
The indexing scheme is illustrated below.
A line of tiles on a diagonal like / will have the same value for x.
A horizontal line of tiles will have the same value for y.
The equations used are presented in Implementation: Hexagonal tiles.

hexHexGrid s returns a grid of hexagonal shape, with
sides of length s, using hexagonal tiles.
The centre of the grid always consists of a single tile.

paraHexGrid r c returns a grid in the shape of a parallelogram with r rows and c columns, using hexagonal tiles.
The indexing scheme is illustrated below.
A line of tiles on a diagonal like / will have the same value for x.
A horizontal line of tiles will have the same value for y.
Depending on whether the number of rows and columns is even or odd,
the centre of the grid may consist of one, two, or four tiles.
