# n-polygon lattice datastructure?

I'm trying to simulate a boardgame what can be played on a board with an arbitrary lattice, anything from triangles to heptagons to 37-sided regular polygons is allowed. Moreover the shape of the board is also arbitrary.

I need to represent this board in a data structure in which each tile has as its property a list of all its neighbouring tiles.

I was wondering if there is already some work done related to this that I might find helpful?

The way I'm trying to approach this problem is as follows: I first devise a coordinate system. Then I situate the virtual board within the coordinate system. Then I lay down the first tile and recursively lay down all neighbouring tiles until I cross the border. The approach is quite ugly and there is some uncertainty involved as I'm using angles and such to figure out the coordinates of each tile and it's all very messy. There must surely be a better way.

The board you want to draw is a planar graph whose faces (enclosed areas between edges) are the polygonal tiles: call this $G_\mathrm{b}$. The data structure you have in memory is a graph $G_\mathrm{m}$ whose vertices are the tiles and whose edges are the adjacency relation on the tiles. This graph is known as the dual of $G_\mathrm{b}$. So, you need to compute the dual of $G_\mathrm{m}$ and use one of the algorithms for drawing planar graphs to draw that.
One possibe headache is that duals are not uniquely defined, as the Wikipedia article shows, so you might need to be careful to get the "correct" dual for your application. If you can't get that to work, another option would be to use a graph drawing algorithm to draw $G_\mathrm{m}$ and then obtain the board by using the perpendicular bisector of each edge.