How can I get non-totalistic rules for a 2-dimensional cellular automaton?

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

RulePlot[CellularAutomaton[2]]


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:

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:

• 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. Commented Jul 12, 2020 at 17:17

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.

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


It produces the following 2D automaton:

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


• 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.
– Ivan
Commented Jun 28, 2020 at 4:23
• @IvanMartinez Please provide an example of rules in the question. It’s the best way to avoid any confusion. Commented Jun 28, 2020 at 6:19
• I updated the question with a picture of the output I am expecting!
– Ivan
Commented Jun 28, 2020 at 13:48