0 fps

About Cyclic Cellular Automata

Cyclic Cellular Automata (CCA) are a family of two-dimensional grid models where each cell cycles through N discrete states (0, 1, 2, …, N−1). At each generation, a cell in state s advances to state (s+1) mod N if and only if at least threshold of its neighbours are already in state s+1. This minimal rule produces self-organising spiral waves and rotating target patterns without any central coordination.

With a small N (3–5 states) and threshold 1–2, the grid rapidly self-organises into rotating spirals that persist indefinitely. Raising N to 10–16 shifts the behaviour toward concentric target waves (resembling the Belousov–Zhabotinsky reaction). The Moore neighbourhood (8 neighbours) produces tighter, more symmetric patterns than the Von Neumann neighbourhood (4 neighbours).

CCA were studied extensively by David Griffeath and Janko Gravner in the 1990s. They serve as discrete analogues of excitable media in biology and chemistry, illustrating how local rules give rise to global order — a key theme in complexity science, emergent computation and generative art.

Frequently Asked Questions

What is a cyclic cellular automaton?
A cyclic cellular automaton (CCA) is a grid model where each cell holds one of N states and advances to the next state whenever a sufficient number of neighbours already hold that next state. The rule is purely local, yet the grid self-organises into global spiral and wave patterns over hundreds of generations.
Why do spiral patterns appear?
Spirals emerge because the cyclic rule creates rotating wavefronts. Each state advances only when the next state is present nearby, so colour bands chase each other in a cycle. When a wavefront curves slightly (due to random initial conditions), the curvature amplifies into a full rotating spiral — the same mechanism seen in the Belousov–Zhabotinsky chemical reaction.
What does the threshold slider do?
The threshold is the minimum number of neighbours that must be in state s+1 before a cell advances from state s. Threshold 1 produces fast-spreading aggressive fronts and tight spirals. Higher thresholds (3–4) slow propagation, require denser clusters before a wave can advance, and often produce fragmented or frozen patterns depending on N.
What is the difference between Moore and Von Neumann neighbourhoods?
The Moore neighbourhood includes all 8 surrounding cells (including diagonals), while the Von Neumann neighbourhood uses only the 4 orthogonal neighbours (up, down, left, right). Moore produces rotationally smoother spirals because more connectivity allows wavefronts to propagate diagonally. Von Neumann creates more angular, diamond-shaped patterns.
How many states N should I use for the best spirals?
N = 3–6 with threshold 1–2 and Moore neighbourhood reliably produces vivid rotating spirals within the first 50–100 generations. N = 2 collapses to a parity rule with no spirals. N > 12 tends to produce slower-moving concentric target rings rather than tight spirals, especially with higher thresholds.
Is this related to Conway's Game of Life?
Both are 2D cellular automata on a grid with local rules, but they differ fundamentally. Game of Life uses binary states (alive/dead) with birth and survival counts. CCA uses N cyclic states and a threshold rule. Life produces complex gliders and static structures; CCA produces self-organising wave patterns. Neither can simulate the other directly.
What real-world phenomena does CCA model?
CCA is a discrete analogue of excitable media — systems where each unit can be excited, then refractory, then ready again. Real-world examples include the Belousov–Zhabotinsky oscillating chemical reaction, cardiac muscle wave propagation (including dangerous spiral-wave arrhythmias), calcium waves in cells, and some epidemic spreading models.
Does the simulation wrap around at the edges?
Yes. The grid uses toroidal boundary conditions — the left edge connects to the right, and the top connects to the bottom. This eliminates edge effects and allows spirals and waves to travel across the entire grid without interruption, making the emergent patterns cleaner and more uniform.
Why does the pattern sometimes freeze or become uniform?
With high thresholds (3–4) and small N (3–4), it is possible for the grid to enter a frozen state where no cell has enough neighbours to advance. The cyclic rule can also converge to a uniform state if one state dominates. Click Reinit to restart with a fresh random grid and explore different N/threshold combinations.
How is the rendering done at high speed?
Each generation, the grid state is mapped to an RGBA ImageData buffer at native resolution, then drawn via drawImage to the display canvas. This avoids fillRect per-cell overhead, enabling grids up to 400×400 at 15–30 fps in most browsers. The colour mapping uses a fast HSL-to-RGB computation with no external libraries.
Can I use these patterns in my own projects?
The cyclic CA algorithm is in the public domain — it is a well-known academic model. You are welcome to use the idea and your own implementation of the algorithm freely. The specific JavaScript source code on this page belongs to mysimulator.uk; if you wish to reuse it, please credit the source.

About Cyclic Cellular Automata — Spiral Wave Patterns

Cyclic Cellular Automata (CCA) simulate a two-dimensional grid where each cell holds one of N discrete states cycling from 0 to N-1. A cell advances to its next state only when at least a threshold number of its neighbours already hold that next state — the Greenberg-Hastings excitable-media rule. From a random initial configuration, this purely local interaction spontaneously self-organises into rotating spiral waves and concentric target waves without any central control.

CCA serve as a discrete analogue of excitable media found throughout nature, most famously the Belousov-Zhabotinsky oscillating chemical reaction and spiral-wave dynamics in cardiac muscle tissue, making them an important tool for studying emergence in complex systems.

Frequently Asked Questions

What is a cyclic cellular automaton?

A cyclic cellular automaton is a grid model where each cell holds one of N states (0 through N-1) arranged in a cycle. At each generation a cell in state s advances to state (s+1) mod N if and only if at least a specified threshold number of its neighbours are already in state s+1. This minimal local rule produces rich global pattern formation — rotating spirals and target waves — without any top-down coordination.

How do I use the simulation controls?

Use the States N slider (3-16) to set the cycle length — low values (3-6) produce tight spirals while high values (10-16) produce target waves. The Threshold slider (1-8) sets how many neighbours must be in the next state before a cell advances; lower thresholds spread waves faster. Toggle between Moore (8 neighbours including diagonals) and Von Neumann (4 orthogonal neighbours) neighbourhoods, and click or drag on the canvas to seed a fresh disturbance at any point.

Why do spiral patterns emerge from random noise?

Spirals emerge because the cyclic rule creates travelling wavefronts where each colour band chases the next. When a wavefront curves slightly due to random initial conditions, the curvature self-amplifies: the outer arc of a curve advances faster than the inner arc, rotating the entire structure into a persistent spiral. This is the same curvature-driven mechanism observed in the Belousov-Zhabotinsky chemical reaction and in cardiac reentrant arrhythmias.

What is the Greenberg-Hastings model?

The Greenberg-Hastings model, introduced by James Greenberg and Stuart Hastings in 1978, is a cellular automaton designed to capture the essential dynamics of excitable media. Each cell passes through an excited state, a refractory period, and then returns to a resting state ready to be excited again — directly analogous to a neuron firing and recovering. The CCA threshold rule is a simplified discrete version of this framework where the number of states N controls the length of the refractory period relative to the excitation.

What real-world phenomena does CCA model?

CCA is a discrete model of excitable media, capturing the dynamics of the Belousov-Zhabotinsky oscillating chemical reaction (which produces visible rotating colour spirals in a Petri dish), spiral-wave reentry in cardiac muscle (implicated in ventricular fibrillation), calcium signalling waves in cells, and retinal spreading depression. The mathematical correspondence is close enough that CCA simulations are used in theoretical biology to study how spiral waves nucleate and break down.

Is there a common misconception about how CCA spirals form?

A common misconception is that spirals are seeded directly by the random initial state — that some special initial configuration is needed. In fact, virtually any random initial condition (for low N and threshold) will self-organise into spirals within tens of generations. The spirals are an attractor of the dynamics, not a property of the initial state. Another misconception is that the simulation requires complex code: the entire rule fits in a single line of logic applied uniformly to every cell.

Who discovered cyclic cellular automata and when?

The systematic study of CCA as a mathematical object was pioneered by David Griffeath and Janko Gravner at the University of Wisconsin-Madison during the late 1980s and 1990s. Griffeath's Primordial Soup Kitchen website (1994 onwards) was an early web resource popularising CCA. Their work built on the Greenberg-Hastings (1978) excitable-media model and on Winfree's (1972) studies of spiral waves in the Belousov-Zhabotinsky reaction, unifying these strands into a rigorous probabilistic cellular automata framework.

What other simulations are related to cyclic CA?

Closely related simulations include Conway's Game of Life (binary-state CA), Brian's Brain (3-state excitable CA), the Belousov-Zhabotinsky reaction simulator (continuous reaction-diffusion), and the Greenberg-Hastings lattice model. On this site, Diffusion-Limited Aggregation explores another form of pattern emergence from local rules, while Flow Fields and Mandelbrot Set Explorer demonstrate different classes of generative pattern. Turing reaction-diffusion systems produce similar spiral and target waves through a fundamentally different (continuous PDE) mechanism.

How is CCA used in engineering or technology?

CCA-inspired excitable-media models inform the design of defibrillation protocols — cardiac spiral waves (reentrant arrhythmias) cause ventricular fibrillation, and understanding how to break or prevent them is a direct clinical application. In engineering, CCA dynamics have been applied to parallel computing (self-timed circuits that propagate signals as waves), distributed robot coordination (stigmergy-based swarm algorithms), and image processing (segmentation by wave propagation). The GPGPU implementation used in this simulation — computing thousands of cells in parallel on the GPU — reflects how reaction-diffusion simulations are run in scientific computing.

What are current research frontiers for cyclic CA and excitable media?

Active research areas include three-dimensional CCA (scroll waves and knotted filaments, relevant to cardiac 3D tissue), stochastic CCA (adding noise to study robustness of spiral formation), and heterogeneous excitable media (variable threshold across the grid, modelling tissue inhomogeneity). In physics, the connection between CCA and the universality classes of directed percolation remains an open question. Neuromorphic computing researchers are investigating whether excitable-media dynamics can implement energy-efficient wave-based computation on hardware, echoing early cellular automata proposals by von Neumann and Codd.