1 / 2 / 3: Life / elementary 1D / Langton's ant SPACE: run / pause S: single step ← / →: speed, halve / double (1 – 512 steps per frame) Drag: draw live cells E + drag: erase C: clear (in 1D mode: restart the diagram) P: Life: next pattern · 1D: next famous rule · ant: 1 – 4 ants R: Life: random soup · 1D: toggle single-cell / random seed ↑ / ↓: 1D mode only: rule number ±1, all the way through 0 – 255 Life patterns: glider, Gosper glider gun, pulsar, pentadecathlon, R-pentomino, acorn, diehard, LWSS fleet. Famous rules on P: 30, 90, 110, 150, 184, 22, 105, 60 — but every rule from 0 to 255 is reachable one step at a time with the arrows, and the interesting ones are not all famous. A cell that has died is drawn dimmer than one that was never alive, so the board keeps a ghost of everywhere the automaton has been. In ant mode that trail is the output.
Three families of cellular automaton on one pen canvas — Conway's Life with a pattern library, all 256 elementary rules as space-time diagrams, and Langton's ant — every one of them drawable on and steppable by hand. THE INTERESTING DECISION: NEVER COUNT NEIGHBOURS The textbook Life step counts eight neighbours for every cell. On this 64×42 board that is ~85,000 list reads per generation, and in Scratch it pins the thing to a handful of generations a second. So cnt holds a live-neighbour count per cell and is maintained incrementally. toggle is the only way any cell ever changes — patterns, mouse painting, the ant and Life itself all go through it — and it repairs the eight surrounding counts as it goes. A generation is then one linear pass reading a single number per cell, and a dead cell with count 0 is rejected on that one read, which is most of an ordinary board. Measured against the naive version on the same 200 generations: 4,838,400 list operations down to 770,822 for the R-pentomino, 6.3× fewer (7.1× for the glider gun). The board is stored 66×44 for a 64×42 playfield. The one-cell dead border is what lets toggle update eight neighbours with no bounds checks at all; it is never scanned, so it stays dead and acts as an absorbing boundary. The 1D mode has its own grid at 3px rather than reusing Life's 7px, because rule 30's structure is simply invisible at 64 columns. 152 columns, toroidal, and the row hue ramps with time so a screenful reads as a gradient. Runs of live cells are stroked as single lines rather than dots — with pen size 3 a stroke from the first to the last centre of a run covers it exactly, since Scratch's round cap overhangs by half a cell at each end. VERIFICATION All three automata were checked against independent Python implementations by running the compiled .sb3 under the headless harness and dumping state: * Life — Gosper gun, generation 65: population 54, matching the reference exactly (neighbouring generations are 61 / 54 / 61, so it is not a coincidence). * Rule 30 — after 71 generations, all 152 cells of the live row match the reference bit for bit. * Langton's ant — after 2,016 steps: 206 live cells, ant at (30, 21) heading south. Exact match, position and heading included. HONEST LIMITATIONS * Life's boundary absorbs rather than wraps, so a glider that reaches the edge dies and the Gosper gun eventually jams itself in the corner. The ant wraps — it would otherwise walk off the board within a few thousand steps. * 64×42 is small for Life. It is a compromise: the cells have to stay big enough to see and to click on, and every cell is a separate pen stroke. * The 1D diagram is 152 cells wide, which is a lot better than 64 but still narrow enough that rule 110's long-range structure wraps around itself. When the diagram reaches the bottom the screen wipes and evolution continues from where it was, rather than restarting. * There is no undo on the drawing tool, and no way to save a pattern you drew. Speed is steps per frame*, so the slowest continuous setting is still 30 generations a second. Anything slower is S, one step at a time. All original - code, art and sound. See Inside is open.