Question:

Specify rules for 2D cellular automaton?

Grayson: 2 days ago

If I want my rule to affect cells in this way:

  • dead $\to$ dead $\iff$ Cell has $n$ living neighbours, $n\in A$
  • dead $\to$ alive$\iff$ Cell has $n$ living neighbours, $n\in B$
  • alive $\to$ dead $\iff$ Cell has $n$ living neighbours, $n\in C$
  • alive $\to$ alive $\iff$ Cell has $n$ living neighbours, $n\in D$

(where neighborhood of a cell consists of all closest surrounding cells)

Then, how do I specify my rule?

ArrayPlot[Last[CellularAutomaton[rule, board, step]]]


For example, if $A=C=\{0,2,4,6,8\}, B=D=\{1,3,5,7\}$, and

board = Table[If[i == j == 20, 1, 0], {i, 1, 41}, {j, 1, 41}]

and step goes from $0$ to $15$, then we should have this replicator pattern:

enter image description here

Which was taken from Terrific Toothpick Patterns - at 14:51 (https://youtu.be/_UtCli1SgjI?t=891)

So how to convert given $A,B,C,D$ to a rule that gives, for example the pattern above?

Answer:
Eli: 2 days ago

The example where $A = C$ and $B = D$ can be achieved using GrowthSurvivalCases option of CellularAutomata (as of Mathematica 11.1, I believe):

init = CenterArray[{30, 30}];

res = CellularAutomaton[<|
    "Dimension" -> 2,
    "GrowthSurvivalCases" -> {
      {1, 3, 5, 7},
      {1, 3, 5, 7}
      }|>, init, 15];

Partition[ArrayPlot /@ res, 3] // Grid

Mathematica graphics