Specifying (and plotting) the rules of cellular automata in 1-dimension is really straight forward with the code:


enter image description here

In this case, we can see the output for every possible state when we consider only nearest neighbours.

How can we do this for the 2-dimensional case? I have tried using:

RulePlot[CellularAutomaton[{110, {2, 1}, {1, 1}}]]

But my result is the following:

enter image description here

This returns the totalistic case and I want a rule which depends on the nearest neighbours of every cell. Something like in the 1-dimensional case, but instead of only considering the right and left neighbours, I want it to consider the upper and lower neighbours as well.

What I want looks something like this (consider the corners' grey squares as a background), I just want the output to be dependent on the right, left, upper and lower neighbours:

enter image description here

  • $\begingroup$ I have been able to turn the diagram you added giving the rules for your cellular automation into a form accepted byCellularAutomaton. However, RulesPlot doesn't give a rules plot for this set of rules. This happens: AFAIK, RulesPlot doesn't always work, even when the rules are valid. If your only interest is getting Mathematica to make a rule plot in the form you show, I can't help you any further. If you are interested in looking at code that generates valid rules, I am willing to update my answer to show that code and the behavior of the automaton it produces. $\endgroup$
    – m_goldberg
    Commented Jul 12, 2020 at 17:17

1 Answer 1


Your question isn't entirely clear to me, but my best guess is that you want a rule that uses the Von Neumann neighborhood of a cell rather than the Moore neighborhood. Here is an example of such a rule.

  CellularAutomaton[{110, {2, {{0, 2, 0}, {2, 1, 2}, {0, 2, 0}}}, {1, 1}}], 
  ImageSize -> Full]


It produces the following 2D automaton:

ca5 =
    {110, {2, {{0, 2, 0}, {2, 1, 2}, {0, 2, 0}}}, {1, 1}}, {{{1}}, 0}, 11];
Multicolumn[ArrayPlot /@ ca5]


  • 1
    $\begingroup$ Actually, I am looking for a similar way to represent the rule. But I would want to define the rule in terms of the form of it's neighbourhood. For example, if {left,right,upper,lower}={black,white,white,black} -> white and so on for each possible neighbourhood. $\endgroup$
    – Ivan
    Commented Jun 28, 2020 at 4:23
  • 1
    $\begingroup$ @IvanMartinez Please provide an example of rules in the question. It’s the best way to avoid any confusion. $\endgroup$
    – C. E.
    Commented Jun 28, 2020 at 6:19
  • $\begingroup$ I updated the question with a picture of the output I am expecting! $\endgroup$
    – Ivan
    Commented Jun 28, 2020 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.