Game of Life: local rules and emerging patterns
Open the Game of Life. Each cell is either alive or dead, yet patterns can remain still, oscillate or move as gliders. This version uses Conway’s B3/S23 rule; Golly’s rule documentation explains the B (birth) and S (survival) notation.
Try three patterns
Pause and clear the board. Click or drag to add live cells; enable Erase to remove them. You can also focus the canvas, move with the arrow keys and draw with Enter or Space.
- Draw a filled block. It should remain unchanged after a step.
- Draw three adjacent cells in a horizontal line. One step makes them vertical; another restores the horizontal line.
- Add a glider and advance four generations. Its pattern shifts one cell diagonally. The button places it at the current cursor position.
Reset restores the seeded board. Clear removes live cells without pausing a running simulation.
Updating one generation
Each cell counts its eight neighbors. A dead cell with exactly three live neighbors is born. A live cell survives with two or three; otherwise it dies. All decisions read the old grid and write a new one, then the grids are exchanged. Updating in place would expose later cells to already changed neighbors and produce a different rule.
The board has cells with opposite edges connected, forming a torus. A pattern leaving the right edge reappears on the left and may eventually collide with earlier patterns. This is not an infinite plane.
Timing and drawing
The model advances one generation every six simulation updates, targeting about ten generations per second. Step performs six updates too, so it advances exactly one generation independently of display refresh. Canvas 2D draws the live cells and grid lines.
Model tests check a stable block and a glider’s displacement after four generations. They verify the rule, not that every seed produces interesting long-term behavior. Compare reaction–diffusion for a grid with continuous concentrations instead of binary cells.