Wolfram Research

Function Repository Resource:

BlockCellularAutomaton (1.0.0) current version: 2.0.0 »

Source Notebook

Evolve a block cellular automaton

Contributed by: Wolfram Physics Project Team

ResourceFunction["BlockCellularAutomaton"][rule,init,t,phase]

generates a list representing the evolution of the block cellular automaton with the specified rule from initial condition init for t steps, starting in the specified phase.

ResourceFunction["BlockCellularAutomaton"][rule,init]

gives the result of evolving init for one step, with phase 1.

ResourceFunction["BlockCellularAutomaton"][rule,phase]

is an operator form of ResourceFunction["BlockCellularAutomaton"] that represents one step of evolution.

Details and Options

The rules for the block cellular automaton must be specified with replacement rules for blocks or patterns representing blocks.
The length of init should be commensurate with the block size.

Examples

Basic Examples (1) 

Run a block cellular automaton for 20 steps:

In[1]:=
ResourceFunction["BlockCellularAutomaton", ResourceVersion->"1.0.0"][{{1, 1} -> {0, 0}, {1, 0} -> {1, 0}, {0, 1} -> {0, 1}, {0, 0} -> {1, 1}}, {1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0}, 20] // ArrayPlot
Out[1]=

Scope (4) 

Evolve a block cellular automaton for three steps:

In[2]:=
ResourceFunction["BlockCellularAutomaton", ResourceVersion->"1.0.0"][{{1, 1} -> {0, 0}, {1, 0} -> {1, 0}, {0, 1} -> {0, 1}, {0, 0} -> {1, 1}}, CenterArray[{1, 0, 0, 1}, 20], 3]
Out[2]=

Give the result of one step of evolution:

In[3]:=
ResourceFunction["BlockCellularAutomaton", ResourceVersion->"1.0.0"][{{1, 1} -> {0, 0}, {1, 0} -> {1, 0}, {0, 1} -> {0, 1}, {0, 0} -> {1, 1}}, CenterArray[{1, 0, 0, 1}, 20]]
Out[3]=

The operator form equivalent:

In[4]:=
ResourceFunction["BlockCellularAutomaton", ResourceVersion->"1.0.0"][{{1, 1} -> {0, 0}, {1, 0} -> {1, 0}, {0, 1} -> {0, 1}, {0, 0} -> {1, 1}}, 1][
 CenterArray[{1, 0, 0, 1}, 20]]
Out[4]=

Use an "algebraic" replacement rule:

In[5]:=
ResourceFunction["BlockCellularAutomaton", ResourceVersion->"1.0.0"][{{x_, y_} :> {y, x} /; x > y}, {4, 3, 2, 1}, 3] // Grid
Out[5]=

Applications (2) 

A block cellular automaton from A New Kind of Science:

In[6]:=
ArrayPlot[
 ResourceFunction["BlockCellularAutomaton", ResourceVersion->"1.0.0"][{{2, 2} -> {1, 1}, {1, 1} -> {2, 2}, {1, 2} -> {1, 2}, {2, 1} -> {2, 1}, {2, 0} -> {0, 2}, {1, 0} -> {1, 0}, {0, 2} -> {2, 0}, {0, 1} -> {0, 1}, {0, 0} -> {0, 0}}, CenterArray[Table[2, 38], 100], 300, 1]]
Out[6]=

Examples of block cellular automata with more general replacement rules:

In[7]:=
ArrayPlot[
 ResourceFunction["BlockCellularAutomaton", ResourceVersion->"1.0.0"][# -> CellularAutomaton[110][#] & /@ Tuples[{1, 0}, 3], CenterArray[{1}, 200], 100, 2]]
Out[7]=
In[8]:=
ResourceFunction["BlockCellularAutomaton", ResourceVersion->"1.0.0"][{{x_, y_} :> {y, x} /; x > y}, IntegerDigits[1009401, 2], 20] // ArrayPlot
Out[8]=

Version History

  • 2.0.0 – 07 November 2022
  • 1.0.0 – 12 August 2020

Related Resources

License Information