Draft: very much under construction.
Reverse Game of Life Font
What is Conway's Game of Life?
- Our own interactive demo, or link to other people's demos?
Every cell updates at the same time, using its neighbors from the step before.
| Check | Action |
|---|---|
| Dead, with exactly 3 live neighbors | Comes alive |
| Alive, with fewer than 2 live neighbors | Dies |
| Alive, with 2 or 3 live neighbors | Stays alive |
| Alive, with more than 3 live neighbors | Dies |
The question: can we run it backward?
- Original idea: a pixel board you draw on; the algorithm chugs and finds an N-step-back seed (exists in MATLAB:
reverseGameOfLife.m). - Could it work for any black-and-white image?
Five patterns on a 5 × 5 grid with wrap-around edges. A computer can try all 33,554,432 possible starting patterns, so these counts are exact.
Draw a pattern, then press Find seeds.
How the search works
The obvious way is to try every possible seed and see which ones turn into your target. On a 6 × 6 grid that is 236, about 69 billion seeds: too many for a web page.
The trick is that each row of the target depends on only three rows of the seed: the same row, the one above, and the one below. So the search builds the seed one row at a time:
- Before searching, it works out what every possible stack of three rows turns into. On a 6-wide grid that is 218 = 262,144 stacks, done once.
- It picks the seed's first two rows (4,096 choices, tried one after another).
- For each next row, it only tries rows that make the row above come out right in the target. Usually that leaves just a few options, and often none, so dead ends are dropped right away.
- When all six rows are placed, it checks the last two target rows, which wrap around to the top.
Because no possibility is skipped, the count is exact when the search finishes, and "no seed exists" is a proof, not a guess.
For more steps back, it repeats the same search from every seed it found: seeds of seeds. The number of branches can explode, so the search stops after 4 seconds and reports what it found so far.
Why one or two steps back isn't enough
So: make a font
The search: getting N steps back
Local search: genetic algorithm + simulated annealing
- Genetic algorithm: 300 random seeds; score = wrong pixels after N steps; keep the best 30, breed the rest (mix two parents cell by cell, flip ~3% of cells); ~400 generations.
- It gets letters to ~7–10 wrong pixels, then stalls: by ~generation 200 the seeds are near-copies of each other. Works best as a starting point.
- Simulated annealing polishes the GA's best seed: flip 1–2 cells, keep improvements, sometimes keep worse moves (the "temperature"), cooling over time. Does most of the real work: 7–10 → 0–4 wrong pixels.
- Results: 93/94 exact at 1 step, 70/94 at 2, 35/94 at 3.
- Side experiment: chaining two 1-step solves to get a 2-step seed failed (1/94 exact).
Hitting the wall
- Tested every change of 1, 2, 3 and 4 cells around the best seeds: none improved. Stuck in a dip at least 5 flips deep.
- Ten fresh restarts found very different seeds with the same error count, so it looked like a hard floor.
- Show: the E key view below and the old 3-step catalog (30/94 at the time, with error pixels).
SAT solving: turn it into a logic puzzle (Z3)
- Stop guessing: one true/false variable per cell per step (N+1 layers of 10 × 10). The Life rule becomes a logical constraint on every cell; the last layer is fixed to the letter.
- The solver answers one of three ways: here's an exact seed / impossible (a proof: Garden of Eden) / out of time.
- Z3: general-purpose solver from Microsoft Research.
- Result: exact seeds for every letter local search couldn't solve. 2 steps and 3 steps both 94/94. The "hard floor" was local search getting stuck, not the problem. Hardest: & at 3 steps, 40 minutes.
Kissat: a specialist solver
- Z3 handles many kinds of problems; this one is purely true/false, which dedicated SAT solvers are built for. Kissat is one of the top solvers in the annual SAT competitions (used through the PySAT library).
- Rules rewritten in the standard clause format with my own neighbor-counting encoding. The ready-made one in PySAT gave false "solved" answers (half-built: treated 3 neighbors as 4); mine was tested for every count 0–8.
- About 40–50× faster on the same problems (&: 2,401 s → 48 s). Made 4 steps practical.
- 4 steps back: 94/94 exact (finished 2026-10-17). Most letters 10 s – 7 min; the hardest: E 30 min, 3 12 min, h 10 min.