Day 29 Game 29: 30 games in 30 days using Grids
This is what Grids did for us today. What can Grids do for you?
Grids are not just for attractive geometric shapes. Irregular shapes come in grids too 🙂
In today’s game we re-use some familiar mechanics, and give it a new twist: you play the normal Lights Out game, but on an irregular grid!
When you have more than a day, then you can use all kinds of sophisticated algorithms to make it really elegant and fast… but when time presses, brute force combined with lookup tables are your friends. In this case, we first select a point set following a rough Poisson distribution. This ensures the cells will be reasonably attractive. Using the point set, we construct a map that maps any point to the closest point in the set. Groups of points that map to the same point from the original set form a cell. We then create a lookup table that gives us the cell for each (integer) point in the world. Another lookup table is constructed to give all the neighbors of a cell. This is then fed to the grid, which makes it possible to use all our algorithms on this irregular grid.