Conway's Game of Life is usually something you start and then stare at. Giving it a win condition turned a zero player automaton into a puzzle, and made the maths visible in a way that watching never did.
Conway's Game of Life is famously a zero player game. You seed a grid, you press go, and the rules play it. Four lines decide everything:
- a live cell with fewer than two live neighbours dies - a live cell with two or three live neighbours survives - a live cell with more than three live neighbours dies - a dead cell with exactly three live neighbours becomes alive
That is the whole thing, and out of it come gliders, oscillators, still lifes and structures people have spent decades cataloguing.
It is also, as a piece of software you hand someone, a bit inert. You watch. Nothing is asked of you. I wanted to know what happened if something was.
Giving it a win condition
The version I built in C++ with SFML has a Levels mode, and the rule is this: you are given a fixed number of cells to place, and a target number that must still be alive when a countdown ends.
That one constraint changes the activity completely. You are no longer watching a simulation, you are reasoning backwards through it. To get cells alive at second ten, you need a configuration at second zero that does not collapse. So you start thinking about which shapes are stable, which ones oscillate forever, and which ones look busy and promising and are dead within four generations.
Which is to say: the puzzle teaches you the behaviour of the automaton far faster than watching it does. You learn that a block is boring and permanent, that a blinker survives anything, and that most arrangements you would make by instinct die almost immediately.
The level one seed in my screenshots was not designed by hand. I wrote a small search script to find a placement that reliably clears, because hand placing cells and waiting ten seconds to find out you were wrong is not a good use of an evening.
The other two modes
Creative is the sandbox. You place the classic patterns, glider, blinker, toad, beacon and block, and watch each do its thing. The glider is the one worth sitting with: it cycles through four states and comes back to its own shape, translated one square diagonally. Repeat forever and you have something that moves, built out of rules that contain no concept of movement.
Randomize fills the board and lets it settle. This is the fastest way to see the real behaviour of the system, because random boards do not stay random. Within a second or two the chaos burns off and what is left is almost entirely still lifes and short period oscillators. The soup always cools into the same small vocabulary of shapes.
Under it
Two implementation details that mattered more than I expected.
The frame loop is fixed timestep. The simulation advances on its own clock rather than once per rendered frame. Without that, the Game of Life literally runs faster on a better computer, which makes a timed puzzle mode meaningless. Separating simulation rate from frame rate is the kind of thing that is obvious in hindsight and invisible until a level is impossible on one machine and trivial on another.
The update step writes into a new buffer. Each cell reads its eight neighbours and the result goes into a second grid, which is swapped in when the whole pass is done. Update the grid in place and a cell you already processed changes the input of a cell you have not reached yet, so the top left of your board plays by different rules than the bottom right. The bug does not crash anything. It just quietly gives you a different automaton than the one you meant to write, which is worse.
The title screen runs a live fifty by fifty simulation behind the menu, which costs nothing and means the thing is alive before you have clicked anything.
Why it stuck with me
The appeal is the gap between how little is specified and how much comes out. Nothing in those four rules mentions motion, or periodicity, or structures that copy themselves, and all of it is in there anyway.
Building it as a game rather than a demo was the thing that made me actually understand that, because a puzzle forces you to predict the system. Watching only ever asks you to admire it.