Skip to content

CellularAutomaton ​

t+1 fixed-width generations of an elementary 1-D cellular automaton, from init.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageCellularAutomaton✓
CellularAutomaton(rule, init, t)t+1 generations of Wolfram's elementary (k = 2 colors, radius 1) rule number rule, from initial condition init
Typed signatures
TypePackageApplies
(integer<0..255>, integer | list<integer> | tuple<list<integer>, integer>, integer<0..>) -> list<list<integer>>combinatoricsalways

Domain: Collections

Details
  • init is an explicit {list, background} (or {list}, background 0) -- a bare integer like 1 is not valid init (Wolfram raises initn).
  • Every generation has the same width: init's non-background cells span [minPos, maxPos], and the displayed window is [minPos - t, maxPos + t] -- the widest region t steps could possibly reach.
  • A cell of init that already equals background doesn't widen that span -- {{1, 0, 0}, 0} behaves like a single seed at position 0, not like a 3-wide active region.
  • Only the elementary (k = 2, radius 1) rule form is answered; totalistic and multi-color rule specs are left unevaluated.

Examples

Basic #

The classic Rule 30 triangle, from a single seed cell, at its final fixed width

live ↗
InCellularAutomaton(30,[[1],0],3)\mathrm{CellularAutomaton}(30, \bigl\lbrack\bigl\lbrack1\bigr\rbrack, 0\bigr\rbrack, 3)Out[[0,0,0,1,0,0,0],[0,0,1,1,1,0,0],[0,1,1,0,0,1,0],[1,1,0,1,1,1,1]]\bigl\lbrack\bigl\lbrack0, 0, 0, 1, 0, 0, 0\bigr\rbrack, \bigl\lbrack0, 0, 1, 1, 1, 0, 0\bigr\rbrack, \bigl\lbrack0, 1, 1, 0, 0, 1, 0\bigr\rbrack, \bigl\lbrack1, 1, 0, 1, 1, 1, 1\bigr\rbrack\bigr\rbrack

Rule 30 from a single cell, spreading as a triangle

live ↗
InCellularAutomaton(30,[0,0,0,1,0,0,0],2)\mathrm{CellularAutomaton}(30, \bigl\lbrack0, 0, 0, 1, 0, 0, 0\bigr\rbrack, 2)Out[[0,0,0,1,0,0,0],[0,0,1,1,1,0,0],[0,1,1,0,0,1,0]]\bigl\lbrack\bigl\lbrack0, 0, 0, 1, 0, 0, 0\bigr\rbrack, \bigl\lbrack0, 0, 1, 1, 1, 0, 0\bigr\rbrack, \bigl\lbrack0, 1, 1, 0, 0, 1, 0\bigr\rbrack\bigr\rbrack
Scope #

A 3-cell init with only one cell differing from background behaves like a single-seed automaton

live ↗
InCellularAutomaton(90,[[1,0,0],0],2)\mathrm{CellularAutomaton}(90, \bigl\lbrack\bigl\lbrack1, 0, 0\bigr\rbrack, 0\bigr\rbrack, 2)Out[[0,0,1,0,0],[0,1,0,1,0],[1,0,0,0,1]]\bigl\lbrack\bigl\lbrack0, 0, 1, 0, 0\bigr\rbrack, \bigl\lbrack0, 1, 0, 1, 0\bigr\rbrack, \bigl\lbrack1, 0, 0, 0, 1\bigr\rbrack\bigr\rbrack

Seed with background 00 expands the lattice each step

live ↗
InCellularAutomaton(30,[[1],0],2)\mathrm{CellularAutomaton}(30, \bigl\lbrack\bigl\lbrack1\bigr\rbrack, 0\bigr\rbrack, 2)Out[[0,0,1,0,0],[0,1,1,1,0],[1,1,0,0,1]]\bigl\lbrack\bigl\lbrack0, 0, 1, 0, 0\bigr\rbrack, \bigl\lbrack0, 1, 1, 1, 0\bigr\rbrack, \bigl\lbrack1, 1, 0, 0, 1\bigr\rbrack\bigr\rbrack

A cyclic boundary wraps the growth around the edge

live ↗
InCellularAutomaton(30,[1,0,0,0,0,0],2)\mathrm{CellularAutomaton}(30, \bigl\lbrack1, 0, 0, 0, 0, 0\bigr\rbrack, 2)Out[[1,0,0,0,0,0],[1,1,0,0,0,1],[0,0,1,0,1,1]]\bigl\lbrack\bigl\lbrack1, 0, 0, 0, 0, 0\bigr\rbrack, \bigl\lbrack1, 1, 0, 0, 0, 1\bigr\rbrack, \bigl\lbrack0, 0, 1, 0, 1, 1\bigr\rbrack\bigr\rbrack
live ↗
InGrid(CellularAutomaton(73,[[1],0],4))\mathrm{Grid}(\mathrm{CellularAutomaton}(73, \bigl\lbrack\bigl\lbrack1\bigr\rbrack, 0\bigr\rbrack, 4))Out000000001100000000111111000000111111000011001100110000110000000000000011110011111111110011

The same evolution rendered as a grid

live ↗
InGrid(CellularAutomaton(30,[1,0,0,0,0,0],2))\mathrm{Grid}(\mathrm{CellularAutomaton}(30, \bigl\lbrack1, 0, 0, 0, 0, 0\bigr\rbrack, 2))Out110000000000111100000011000011001111
Properties #

Rule 30 on a small cyclic row

live ↗
InCellularAutomaton(30,[1,0,1,1],3)\mathrm{CellularAutomaton}(30, \bigl\lbrack1, 0, 1, 1\bigr\rbrack, 3)Out[[1,0,1,1],[0,0,1,0],[0,1,1,1],[0,1,0,0]]\bigl\lbrack\bigl\lbrack1, 0, 1, 1\bigr\rbrack, \bigl\lbrack0, 0, 1, 0\bigr\rbrack, \bigl\lbrack0, 1, 1, 1\bigr\rbrack, \bigl\lbrack0, 1, 0, 0\bigr\rbrack\bigr\rbrack
Possible issues #

Rule 90 gives the Sierpinski pattern

live ↗
InCellularAutomaton(90,[[1],0],2)\mathrm{CellularAutomaton}(90, \bigl\lbrack\bigl\lbrack1\bigr\rbrack, 0\bigr\rbrack, 2)Out[[0,0,1,0,0],[0,1,0,1,0],[1,0,0,0,1]]\bigl\lbrack\bigl\lbrack0, 0, 1, 0, 0\bigr\rbrack, \bigl\lbrack0, 1, 0, 1, 0\bigr\rbrack, \bigl\lbrack1, 0, 0, 0, 1\bigr\rbrack\bigr\rbrack
About
Examples9
Checked againstWolfram Language 9 agree
CrosswalkWolfram Language