| Problem statement | Source code | Tags: Cellular automataGrid walking
The hexagonal grid looks like this:
We can still label them by rows and columns, and now the neighbors are:
e: (r, c + 2)w: (r, c - 2)ne: (r - 1, c + 1)nw: (r - 1, c - 1)se: (r + 1, c + 1)sw: (r + 1, c - 1)This encoding turns this problem back into a grid problem, where we can use a set of coordinates to track black tiles.
Yet another cellular automaton. The only twist is that the grid is hexagonal instead of square, but that just requires tweaks to the neighbor calculation. Again, the template remains unchanged:
The neighbors are just the six directions defined above.