Chapter 3: The World of Simple Programs

Section 2: More Cellular Automata

Implementation of general cellular automata

With k colors and r neighbors on each side, a single step in the evolution of a general cellular automaton is given by

CAStep[CARule[rule_List, k_, r_], a_List] := rule-1 - ListConvolve[k^Range[0, 2r], a, r + 1]

where rule is obtained from a rule number num by IntegerDigits[num, k, k2r + 1]. (See also page 927.)

From Stephen Wolfram: A New Kind of Science [citation]