This interactive tutorial visualizes cellular automata (CA) — discrete dynamical systems where simple local rules produce emergent complexity. The simulation uses a double-buffered grid engine and supports multiple rule sets used in computer science and physics.
Mathematical Foundation
1. Grid and Neighborhood
A grid of cells evolves in discrete time steps. Each cell has a state, and its next state depends only on its current state and its neighbors — a purely local rule applied everywhere at once:
si(t+1) = f( si(t), neighborsi(t) )
For 2D rules the Moore neighborhood is used — all 8 adjacent cells (orthogonal and diagonal).
2. The rule sets
Each rule set defines its states and transition function. From these few local rules, global structure (gliders, logic gates, fractals) emerges:
Rule set | States | Transition | Notable |
Conway (B3/S23) | dead, alive | Birth on exactly 3 live neighbors; survive on 2–3; else die | Gliders, oscillators, Gosper gun — Turing-complete |
Wireworld | empty, conductor, electron head, tail | Head→Tail; Tail→Conductor; Conductor→Head if 1–2 neighbor heads | Builds diodes, clocks, logic gates — Turing-complete |
Brian’s Brain | ready, firing, refractory | Ready fires if exactly 2 neighbors firing; firing→refractory→ready | Neural-like refractory period; many spaceships |
Seeds | dead, alive | Birth on exactly 2 neighbors; no survival (all die) | Explosive, high-growth patterns |
Rule 30 / 110 | 2 states, 1D | Next cell from the 3-cell pattern (L,C,R) | Rule 30: chaotic/fractal RNG; Rule 110: Turing-complete |
Emergence & universality: several of these rules are Turing-complete — despite trivially simple local update rules, they can in principle compute anything a computer can. Complexity here is not built in; it emerges from iteration.
Simulation
The interactive simulator is below. Use the controls to explore the concepts described above.
Usage
Use the simulation to explore cellular automata:
- Rule: Select Conway, Wireworld, Brian's Brain, Seeds, Rule 30, or Rule 110. The grid re-initializes with a rule-appropriate pattern.
- Instruction frame: Above the grid, context-specific instructions describe what you can do for the selected rule.
- Pattern: Choose a preset (Glider, Gosper Gun for Conway; Clock, Diode, XOR for Wireworld; Single seed, Three cells for Rule 30/110). Click or drag on the canvas to stamp.
- Brush (Wireworld only): When Wireworld is selected, choose Conductor, Electron Head, or Tail to draw with.
- Run / Stop: Toggle the simulation. Step advances one generation. Reset re-initializes; Clear empties the grid; Randomize fills with random cells.
- Speed / Gen: Adjust generations per second. Gen shows total steps. Heatmap: (Conway only, shown when applicable) Color cells by age.
- Draw: Click or drag on the canvas to paint cells. With a pattern selected, stamp at each cell you drag over. For Rule 30/110, edit the top row (seed) for persistent effect.
Info Box
Below the grid, the Rule Info box shows the cell-by-cell operation rules and color codes for the selected rule.
Visual Guide
- Conway/Seeds/Rule 30/110: Green = alive (or 1). Gray grid overlay when paused.
- Wireworld: Yellow = conductor, Blue = electron head, Red = electron tail.
- Brian's Brain: Blue = firing, Gray = refractory, grid = ready.
- Pattern ghost: Dashed green outline shows where the selected pattern will be stamped.
Key Insights
- Emergence: Global patterns (gliders, oscillators) arise from purely local rules.
- Wireworld logic: Build a clock loop, then add a diode for one-way flow. The XOR gate proves Turing-completeness.
- Brian's Brain: The refractory period prevents immediate re-firing, mimicking neural dynamics.
- Rule 30/110: 1D CA; top row is the seed. Rule 30 is chaotic; Rule 110 is Turing-complete.
Limitations
- Finite grid with boundaries: the real theory assumes an infinite lattice. Here the grid is finite, so gliders and signals are clipped or wrapped at the edges.
- Synchronous, deterministic update: all cells update at once from the previous frame (double-buffered). Asynchronous or stochastic CA variants behave differently and are not modelled.
- Discrete time and space: CA are an idealization — they approximate continuous physical processes (diffusion, growth) only qualitatively.
- Turing-completeness is theoretical: Rule 110 and Wireworld are universal in principle, but the small interactive grid cannot host arbitrarily large computations.