Function Repository Resource:

CellularAutomatonNumber

Source Notebook

Convert an explicit list of rules specifying a cellular automaton into the corresponding rule number

Contributed by: Wolfram Physics Project Team

ResourceFunction["CellularAutomatonNumber"][rules]

converts a cellular automaton specified by rules into an equivalent rule number.

Details and Options

The result is returned as a List {n,k,r}, where n is the rule number, k is the number of colors and r is the range.

Examples

Basic Examples (2) 

Generate the elementary rule number for a cellular automaton from a List of rules:

In[1]:=
ResourceFunction[
 "CellularAutomatonNumber"][{{1, 1, 1} -> 0, {1, 1, 0} -> 0, {1, 0, 1} -> 0, {1, 0, 0} -> 1, {0, 1, 1} -> 1, {0, 1, 0} -> 1, {0, 0, 1} -> 1, {0, 0, 0} -> 0}]
Out[1]=

Show that the two specifications are equivalent:

In[2]:=
{ArrayPlot[
  CellularAutomaton[{{1, 1, 1} -> 0, {1, 1, 0} -> 0, {1, 0, 1} -> 0, {1, 0, 0} -> 1, {0, 1, 1} -> 1, {0, 1, 0} -> 1, {0, 0, 1} -> 1, {0, 0, 0} -> 0}, {{1}, 0}, 10]], RulePlot[CellularAutomaton[
   ResourceFunction[
    "CellularAutomatonNumber"][{{1, 1, 1} -> 0, {1, 1, 0} -> 0, {1, 0, 1} -> 0, {1, 0, 0} -> 1, {0, 1, 1} -> 1, {0, 1, 0} -> 1, {0, 0, 1} -> 1, {0, 0, 0} -> 0}]], {{1}, 0}, 10]}
Out[2]=

Scope (1) 

Generate rule numbers for cellular automata with different colors and ranges:

In[3]:=
ResourceFunction[
 "CellularAutomatonNumber"][{{2, 2, 2} -> 0, {2, 2, 1} -> 0, {2, 2, 0} -> 0, {2, 1, 2} -> 0, {2, 1, 1} -> 0, {2, 1, 0} -> 0, {2, 0, 2} -> 0, {2, 0, 1} -> 0, {2, 0, 0} -> 0, {1, 2, 2} -> 0, {1, 2, 1} -> 0, {1, 2, 0} -> 0, {1, 1, 2} -> 0, {1, 1, 1} -> 0, {1, 1, 0} -> 1, {1, 0, 2} -> 0, {1, 0, 1} -> 2, {1, 0, 0} -> 1, {0, 2, 2} -> 1, {0, 2, 1} -> 1, {0, 2, 0} -> 2, {0, 1, 2} -> 0, {0, 1, 1} -> 0, {0, 1, 0} -> 1, {0, 0, 2} -> 0, {0, 0, 1} -> 1, {0, 0, 0} -> 0}]
Out[3]=
In[4]:=
ResourceFunction[
 "CellularAutomatonNumber"][{{1, 1, 1, 1, 1} -> 0, {1, 1, 1, 1, 0} -> 0, {1, 1, 1, 0, 1} -> 0, {1, 1, 1, 0, 0} -> 0, {1, 1, 0, 1, 1} -> 0, {1, 1, 0, 1, 0} -> 0, {1, 1, 0, 0, 1} -> 1, {1, 1, 0, 0, 0} -> 0, {1, 0, 1, 1, 1} -> 0, {1, 0, 1, 1, 0} -> 1, {1, 0, 1, 0, 1} -> 0, {1, 0, 1, 0, 0} -> 1, {1, 0, 0, 1, 1} -> 1, {1, 0, 0, 1, 0} -> 0, {1, 0, 0, 0, 1} -> 0, {1, 0, 0, 0, 0} -> 1, {0, 1, 1, 1, 1} -> 1, {0, 1, 1, 1, 0} -> 0, {0, 1, 1, 0, 1} -> 0, {0, 1, 1, 0, 0} -> 0, {0, 1, 0, 1, 1} -> 0, {0, 1, 0, 1, 0} -> 1, {0, 1, 0, 0, 1} -> 0, {0, 1, 0, 0, 0} -> 0, {0, 0, 1, 1, 1} -> 0, {0, 0, 1, 1, 0} -> 1, {0, 0, 1, 0, 1} -> 1, {0, 0, 1, 0, 0} -> 1, {0, 0, 0, 1, 1} -> 0, {0, 0, 0, 1, 0} -> 0, {0, 0, 0, 0, 1} -> 1, {0, 0, 0, 0, 0} -> 0}]
Out[4]=

Version History

  • 1.0.0 – 12 August 2020

Related Resources

License Information