Skip to content
Sample of Cyclic Cellular Automaton

complexification_net · cyclicCellularAutomaton

Cyclic Cellular Automaton

A Greenberg-Hastings / Rock-Paper-Scissors style cyclic cellular automaton on a 2D torus. Each cell holds a state in 0..N-1; a cell advances to state (s+1) mod N when at least T of its 4-neighbors already hold that next state. Starting from a low-density random seed the system self-organizes into expanding spiral waves, target patterns, and glider-like defects whose lifetime and texture depend on N and T. This kind of CA was popularized in generative art by Tarbell's contemporaneous CATwist / CAWorm experiments and by Fischner's 'Cyclic CA' applet, and produces visuals reminiscent of Belousov-Zhabotinsky reaction fronts and lichen colonies.

Original: https://web.archive.org/web/20041230042637/http://levitated.net/daily/levCAWorm.html

▶ Try the live demo (JS port) ▶ Run reference.py via Pyodide 10 formulas have instant JS ports. The Pyodide path runs the actual Python in your browser — first load is ~6 MB, then instant.

Family
complexification_net
Source
complexification.net
Evolution
cellular_automaton
Render
raster_indexed
Complexity
medium
Agents
400
Year
2003
Author
j.tarbell (style after Fisch / Greenberg-Hastings)

Math essence

Cyclic CA on a periodic N×N grid with K states, 8-neighborhood: each tick, cell (i,j) counts neighbors whose state equals (s_{i,j}-1) mod K; if that count >= threshold, the cell takes that prev state (the wave catches up from behind). With the right (K, threshold) the system develops persistent spirals and target patterns from a uniform random seed.

Parameters

Name Type Default Range Description
dim int 400 100–800 Square grid side length
n_states int 8 4–32 Number of distinct states in the cycle
threshold int 2 1–4 Required neighbor count to advance
palette str fire null–null Palette name (fire / lichen / ember)
seed int null 0–999999 RNG seed

Reference

First 60 lines of reference.py. Full source: library_external/complexification_net/cyclicCellularAutomaton/reference.py

from __future__ import annotations

from typing import ClassVar

import imageio.v2 as imageio
import numpy as np


class CyclicCellularAutomaton:
    family: ClassVar[str] = "complexification_net"
    sketch: ClassVar[str] = "cyclicCellularAutomaton"

    _PALETTES: ClassVar[dict[str, np.ndarray]] = {
        "fire": np.array(
            [
                [10, 0, 30],
                [50, 0, 60],
                [110, 0, 60],
                [180, 30, 40],
                [230, 80, 20],
                [255, 150, 30],
                [255, 220, 80],
                [255, 255, 200],
                [240, 240, 240],
                [200, 200, 220],
                [150, 150, 200],
                [100, 100, 180],
                [50, 50, 150],
                [20, 20, 110],
                [5, 5, 70],
                [0, 0, 40],
            ],
            dtype=np.uint8,
        ),
        "lichen": np.array(
            [
                [30, 20, 10],
                [60, 40, 15],
                [100, 70, 25],
                [140, 100, 40],
                [180, 140, 70],
                [200, 170, 110],
                [220, 200, 150],
                [230, 220, 190],
                [200, 210, 180],
                [160, 190, 160],
                [110, 160, 130],
                [60, 120, 100],
                [30, 80, 70],
                [15, 50, 50],
                [10, 30, 30],
                [5, 15, 15],
            ],
            dtype=np.uint8,
        ),
        "ember": np.array(
            [
                [0, 0, 0],
                [30, 5, 5],
                [80, 15, 5],

Try running it locally

The reference implementation is self-contained Python with numpy. Install the package and run:

python library_external/complexification_net/cyclicCellularAutomaton/reference.py

Need help? See Learn for the standard environment setup, or Playground for an in-browser sketchbook.

More from complexification.net

See all complexification_net artworks →