now the internal representation is a char[][]. Old and moldy for loops and Math min/max to find neighbours. 🤮
I would like to have the grid represented as Linked objects/graphs instead. e.g.
Cell:
Cell north
Cell east
Cell south
Cell west
etc.
or perhaps:
Cell:
Map<Location, Cell> neighbours.
This will make the neighbour lookup super simple and quite easy to read.
A bit more complex during initial construction, but I can live with that.
As an added bonus, this will also add support for non square grids, strange coordinate systems (pentagons/hexagons/triangular etc), n-dimensional grids, should I ever fancy to test that out.
now the internal representation is a char[][]. Old and moldy for loops and Math min/max to find neighbours. 🤮 I would like to have the grid represented as Linked objects/graphs instead. e.g. Cell: Cell north Cell east Cell south Cell west etc. or perhaps: Cell: Map<Location, Cell> neighbours.
This will make the neighbour lookup super simple and quite easy to read. A bit more complex during initial construction, but I can live with that. As an added bonus, this will also add support for non square grids, strange coordinate systems (pentagons/hexagons/triangular etc), n-dimensional grids, should I ever fancy to test that out.