technique

Wolfram CA

Evolve a single row of binary cells generation by generation by looking up each cell's 3-cell neighbourhood in an 8-bit rule number to decide its next state.

Also called: Elementary Cellular Automaton · Wolfram Elementary Cellular Automaton · Elementary cellular automaton · Wolfram elementary CA · 1D CA

What it is

A single row of binary cells, evolved generation by generation. Each cell’s next value comes from looking up its own 3-cell neighbourhood — itself and its two immediate neighbours, all read from the row before — in a table with only 8 possible entries, since three binary cells have exactly 8 arrangements. That whole 8-entry table collapses into one number: read the 8 output bits as a binary string, convert it to decimal, and you get a “rule number” between 0 and 255 that fully determines the automaton’s behaviour. The corpus places this scheme in the 1980s, and it’s also filed under the alias 1D CA — worth holding onto, because the “board” here is a single row, not a 2D grid; successive generations are usually stacked as rows in an image, so the vertical axis reads as time rather than space. That’s the sharp line between this and Cellular Automata more generally, where the grid itself is the space being simulated and each generation overwrites the last, as in Conway’s Game of Life.

How it works

  1. Store the row as an array of 0/1 cells.
  2. For every cell, read its 3-cell neighbourhood — left, self, right, all from the previous generation — and look up the matching output bit in the rule.
  3. Build a whole new array before touching cells. Nature of Code’s implementation ends each generation step with cells = nextgen; — the new row is computed in full first, then swapped in, so a cell’s neighbour lookup always reads the previous generation, never a value already overwritten earlier in the same pass.
  4. Decide what happens at the two ends of the row, since the leftmost cell has no left neighbour and the rightmost has no right one. The Coding Train’s coding challenge #179 treats this as its own build step — “Adding wrap-around” — connecting the row into a loop so the last cell’s right neighbour is the first cell.

The rule number is worth working through by hand once. Nature of Code’s example: the binary number 01011010 translates to the decimal number 90, and therefore it’s named rule 90. Read backwards, that’s the whole encoding: enumerate the 8 possible 3-cell neighbourhoods, write down whether each one turns its centre cell on or off next generation, read those 8 answers as one binary number, and convert to decimal. That decimal number is both the rule’s name and, in binary, its complete lookup table — rule 90’s table is recoverable from “90” alone.

Parameters & tuning

The rule number is the one real parameter, and it’s a big one: it isn’t a dial so much as a selector across 256 entirely different lookup tables, each built from the same three-cell rule shape but each capable of producing its own pattern. This page’s worked example, rule 90, is used because Nature of Code walks through its binary-to-decimal derivation directly — the evidence gathered for this page doesn’t cover what other rule numbers look like, so treat the visual character of any rule besides 90 as something to run and see, not something to take on faith here.

The other real choice is boundary handling: wrap the row into a loop (the Coding Train’s addition) or give the two end cells some other fixed neighbour. Wrap-around means every cell has a well-defined 3-cell neighbourhood with no special case in the update loop; the alternative needs an explicit decision for what a missing neighbour counts as.

Where it’s been used

Both sources behind this page are teaching treatments rather than named artworks. Nature of Code’s Cellular Automata chapter walks through the rule-90 derivation and the cells = nextgen update; the Coding Train’s coding challenge #179, “Wolfram CA,” works through the same territory as a build — explaining what an elementary CA is, explaining the ruleset encoding, calculating the next generation, and adding wrap-around, in that order. No specific generative artwork built on this technique appears in the evidence gathered for this page — a gap in the corpus, not a claim that none exists.

Variants & neighbours

Cellular Automata is the 2D, grid-of-cells case — Conway’s Game of Life is its best-known instance — where the automaton simulates a space directly, generation overwriting generation, rather than stacking one-row generations into an image of time. Probabilistic cellular automaton rules is a variant of that 2D case, not of this one: it keeps Game of Life’s grid but replaces its deterministic birth/death outcomes with percentage chances, e.g. an overcrowded cell dying only 80% of the time. Both are useful to hold against the elementary CA specifically, because they show what’s fixed here that isn’t fixed there — one binary row, one fixed lookup table, no probability anywhere in it.

Go deeper

Connected to

Contrast with: Cellular Automata

Further reading: The Coding Train · The Nature of Code


Revision 1 · 2 sources · Something wrong? Tell us.