Function Repository Resource:

DynamicCellularAutomaton

Source Notebook

Generate a cellular automaton evolution with initial conditions chosen by a click

Contributed by: Wolfram Staff

ResourceFunction["DynamicCellularAutomaton"][rule,t]

generates an array plot of the evolution of the cellular automaton with specified rule from zero initial condition for t steps and allows the choice of different initial conditions with a click.

ResourceFunction["DynamicCellularAutomaton"][rule,{t,x}]

allows offsets up to x on on the left and on the right.

Details and Options

A click in the array plot created by ResourceFunction["DynamicCellularAutomaton"][] sets up the evolution to start from the point in the top row in the column pointed to by the click.
Clicks at several points set up more complex initial conditions.
A second click on the same column removes that part of the evolution.
ResourceFunction["DynamicCellularAutomaton"][rule] is equivalent to ResourceFunction["DynamicCellularAutomaton"][rule,20].
ResourceFunction["DynamicCellularAutomaton"][rule,] accepts the rule specification in the same form that is allowed in CellularAutomation[rule].
ResourceFunction["DynamicCellularAutomaton"] accepts the options of ArrayPlot.

Examples

Basic Examples (2) 

Create a rule 30 evolution by evaluating the input and clicking in the graphics:

In[1]:=
ResourceFunction["DynamicCellularAutomaton"][30]
Out[1]=

Click several times to use more complex initial conditions:

In[2]:=
ResourceFunction["DynamicCellularAutomaton"][30]
Out[2]=

Scope (4) 

Specify a rule by number:

In[3]:=
ResourceFunction["DynamicCellularAutomaton"][110]
Out[3]=

Specify the rule as a string:

In[4]:=
ResourceFunction["DynamicCellularAutomaton"]["Rule30"]
Out[4]=

Specify the number of steps:

In[5]:=
ResourceFunction["DynamicCellularAutomaton"][30, 10]
Out[5]=

Alternatively:

In[6]:=
ResourceFunction["DynamicCellularAutomaton"][30, {10}]
Out[6]=

Create a wider canvas to specify more complex initial conditions:

In[7]:=
ResourceFunction["DynamicCellularAutomaton"][30, {10, 30}]
Out[7]=

Options (3) 

Use options of ArrayPlot:

In[8]:=
ResourceFunction["DynamicCellularAutomaton"][30, ColorRules -> {1 -> Pink, 0 -> Yellow}]
Out[8]=

Turn off the mesh:

In[9]:=
ResourceFunction["DynamicCellularAutomaton"][30, Mesh -> False]
Out[9]=

Specify the image size:

In[10]:=
ResourceFunction["DynamicCellularAutomaton"][30, ImageSize -> Small]
Out[10]=

Version History

  • 2.0.0 – 30 December 2019
  • 1.0.0 – 06 November 2019

License Information