Conway's Game of Life
A cellular automaton where four tiny rules produce emergent complexity. Age-tinted cells drift across a toroidal grid, seeded with classic patterns.
Conway's Game of Life is a zero-player automaton on an infinite grid of cells. Each generation, every cell lives, dies, or is born based on a count of its eight neighbors. Those four rules — and nothing else — produce gliders, oscillators, spaceships, and even patterns that compute.
Rules
For every cell at each tick:
- A live cell with 2 or 3 live neighbors survives.
- A live cell with fewer than 2 or more than 3 dies (underpopulation / overcrowding).
- A dead cell with exactly 3 live neighbors becomes alive.
That's it. In Life notation: B3/S23.
This visualization
The grid here is toroidal — edges wrap, so gliders travel forever instead of dying at a boundary. Cells are age-tinted: freshly-born cells glow lime-green, and the color cools toward blue the longer a cell survives. Stable structures tend toward blue; chaotic fronts stay green.
The pattern selector seeds a few of the most famous configurations:
- Glider — the smallest spaceship; moves diagonally, 4 generations per step.
- Blinker — a period-2 oscillator. Three cells in a row flip to a column and back.
- Pulsar — period-3 oscillator, one of the most common larger oscillators.
- Lightweight spaceship (LWSS) — moves horizontally, twice as fast as a glider.
- Gosper glider gun — first known pattern with unbounded growth. Emits a glider every 30 generations.
- R-pentomino — five cells of pure chaos. Doesn't stabilize for 1103 generations.
- Acorn — seven cells that take 5206 generations to stabilize into 633 live cells plus 13 escaping gliders.
Tech
- Two
Uint8Arraybuffers are swapped each generation to avoid per-frame allocation. - A parallel
Uint16Arraytracks cell age for color interpolation. - Neighbor lookup uses
(i + n + N) % Nfor wraparound on both axes. - A single
requestAnimationFrameloop with an accumulator advances as many generations as the target speed demands, independent of frame rate. - A
ResizeObserverrecomputes grid dimensions from container size ÷ cell size and re-seeds the current pattern centered.