Wolfram Research

MobileAutomaton

Contributed by: Stephen Wolfram

Source Notebook

Compute the evolution of a mobile automaton

ResourceFunction["MobileAutomaton"][rule,init,t]

generates a list representing the evolution of the mobile automaton or block mobile automaton with the specified rule from initial condition init for t steps.

ResourceFunction["MobileAutomaton"][rule,init]

gives the result of evolving init for one step.

ResourceFunction["MobileAutomaton"][rule]

is an operator form of ResourceFunction["MobileAutomaton"] that corresponds to one step of evolution.

Details and Options

The state for a mobile automaton is given in the form {{a1,a2,}, n}, where the ai are values of cells and n is the position of the active cell.
The rules for a basic mobile automaton are given as a list of elements of the form {{a-1,a0,a1}{ap,dn}} where ap is the new value of the active cell, and dn is its displacement.
The rules for a block mobile automaton are given as a list of elements of the form {{a-1,a0,a+1}{{ap-1,ap0,ap+1},dn}} where the api are the new values for the block of cells, and dn is the displacement of the active cell.
The rules for a basic mobile automaton can be given as a pair of integers, in which case they will be decoded as specified in NKS page 887.
If the position of the active cell would be outside the range defined by the list of cells given, it is taken to be None.

Examples

Basic Examples

5 steps in the evolution of the mobile automaton from NKS page 71:

In[1]:=
ResourceFunction[
 "MobileAutomaton"][{{1, 1, 1} -> {0, 1}, {1, 1, 0} -> {0, 1}, {1, 0, 1} -> {1, -1}, {1, 0, 0} -> {0, -1}, {0, 1, 1} -> {0, -1}, {0, 1, 0} -> {0, 1}, {0, 0, 1} -> {1, 1}, {0, 0, 0} -> {1, -1}}, {Table[
   0, 11], 5}, 5]
Out[1]=

60 steps of evolution:

In[2]:=
ArrayPlot[
 ResourceFunction[
   "MobileAutomaton"][{{1, 1, 1} -> {0, 1}, {1, 1, 0} -> {0, 1}, {1, 0, 1} -> {1, -1}, {1, 0, 0} -> {0, -1}, {0, 1, 1} -> {0, -1}, {0, 1, 0} -> {0, 1}, {0, 0, 1} -> {1, 1}, {0, 0, 0} -> {1, -1}}, {Table[0, 41], 20}, 60][[All, 1]]]
Out[2]=

Evolution of the generalized mobile automaton from NKS page 73:

In[3]:=
ArrayPlot[
 ResourceFunction[
   "MobileAutomaton"][{{1, 1, 1} -> {{0, 0, 0}, -1}, {1, 1, 0} -> {{1, 0, 1}, -1}, {1, 0, 1} -> {{1, 1, 1}, 1}, {1, 0, 0} -> {{1, 0, 0}, 1}, {0, 1, 1} -> {{0, 0, 0}, 1}, {0, 1, 0} -> {{0, 1, 1}, -1}, {0, 0, 1} -> {{1, 0, 1}, 1}, {0, 0, 0} -> {{1, 1, 1}, 1}}, {Table[0, 41], 20}, 60][[All, 1]]]
Out[3]=

Position of the active cell in the generalized mobile automaton:

In[4]:=
ListLinePlot[
 ResourceFunction[
   "MobileAutomaton"][{{1, 1, 1} -> {{0, 0, 0}, -1}, {1, 1, 0} -> {{1, 0, 1}, -1}, {1, 0, 1} -> {{1, 1, 1}, 1}, {1, 0, 0} -> {{1, 0, 0}, 1}, {0, 1, 1} -> {{0, 0, 0}, 1}, {0, 1, 0} -> {{0, 1, 1}, -1}, {0, 0, 1} -> {{1, 0, 1}, 1}, {0, 0, 0} -> {{1, 1, 1}, 1}}, {Table[0, 41], 20}, 800][[All, -1]]]
Out[4]=

Complete evolution display:

In[5]:=
ResourceFunction["MobileAutomatonPlot"][
 ResourceFunction[
  "MobileAutomaton"][{{1, 1, 1} -> {{0, 0, 0}, -1}, {1, 1, 0} -> {{1, 0, 1}, -1}, {1, 0, 1} -> {{1, 1, 1}, 1}, {1, 0, 0} -> {{1, 0, 0}, 1}, {0, 1, 1} -> {{0, 0, 0}, 1}, {0, 1, 0} -> {{0, 1, 1}, -1}, {0, 0, 1} -> {{1, 0, 1}, 1}, {0, 0, 0} -> {{1, 1, 1}, 1}}, {Table[0, 21], 10}, 60], Mesh -> True]
Out[6]=

Color the active cell red:

In[7]:=
ArrayPlot[
 MapAt[Red &, #1, #2] & @@@ ResourceFunction[
   "MobileAutomaton"][{{1, 1, 1} -> {{0, 0, 0}, -1}, {1, 1, 0} -> {{1, 0, 1}, -1}, {1, 0, 1} -> {{1, 1, 1}, 1}, {1, 0, 0} -> {{1, 0, 0}, 1}, {0, 1, 1} -> {{0, 0, 0}, 1}, {0, 1, 0} -> {{0, 1, 1}, -1}, {0, 0, 1} -> {{1, 0, 1}, 1}, {0, 0, 0} -> {{1, 1, 1}, 1}}, {Table[0, 41], 20}, 60]]
Out[7]=

Scope

Use rule numbers to specify a mobile automaton rule:

In[8]:=
ResourceFunction["MobileAutomatonPlot"][
 ResourceFunction["MobileAutomaton"][{35, 57}, {Table[0, 21], 10}, 60], Mesh -> True]
Out[9]=

When the active cell goes out of the region defined, its position is given as None:

In[10]:=
ResourceFunction[
 "MobileAutomaton"][{{1, 1, 1} -> {0, 1}, {1, 1, 0} -> {0, 1}, {1, 0, 1} -> {1, -1}, {1, 0, 0} -> {0, -1}, {0, 1, 1} -> {0, -1}, {0, 1, 0} -> {0, 1}, {0, 0, 1} -> {1, 1}, {0, 0, 0} -> {1, -1}}, {Table[
   0, 7], 3}, 10]
Out[10]=

Resource History

Source Metadata

See Also