This computes and plots 127 steps of the evolution of 150R (the reversible version of rule 150).

 CellularAutomaton[{Mod[Total[Flatten[#]], 2] &, {}, {{-1, 
     0}, {0, -1}, {0, 0}, {0, 1}}, 2}, {{{1}, {1}}, 0}, 127]]

This example appears as part of the documentation of CellularAutomaton. How can I compute the evolution of other reversible rules, like 37R, 90R, etc.?

Edit: Below is an image showing the transition functions of both rule 150 and 150R.

rule 150 rule 150 transitions

rule 150R rule 150R transitions

Rule 150R does a XOR between the regular output of rule 150 for $t+1$ and the state of the cell at $t-1$. Other reversible CA have the same bit-flip behavior when $t-1$ is 1.

  • 2
    $\begingroup$ What is the rule for said cellular automata? It is also not clear to me how it will help you if we implement cellular automata x, it won't be more instructive than the example you already have. $\endgroup$
    – C. E.
    Jun 2, 2015 at 5:15
  • $\begingroup$ Oh, the question is how "150" was specified here. The rule is the same as ECA rule 150, flipping the value generated by 150 in t+1 if the cell was '1' in t-1. I'll include this in an image. $\endgroup$ Jun 2, 2015 at 13:56
  • $\begingroup$ Another question then: why can't you solve it? You have an example of how to do what you want to do. What specifically is it that you are having trouble with? Are the rules for other cellular automata more complicated? $\endgroup$
    – C. E.
    Jun 2, 2015 at 18:08
  • $\begingroup$ The question is how was the transition function for 150R specified here: "{Mod[Total[Flatten[#]], 2] &, {}, {{-1, 0}, {0, -1}, {0, 0}, {0, 1}}, 2}" Other reversible CA have the same bit-flip behavior when t-1 is 1. $\endgroup$ Jun 3, 2015 at 15:14

1 Answer 1


The higher order CellularAutomaton is not well documented. Anyway, this is my attempt to define 37R automaton. I am not completely sure if it works correctly, but for me, for a while, it works OK.

First I define the function that gives the new cell depending on two 3-cell neighborhoods. The 37R rule function is defined by

    d37 = IntegerDigits[37, 2, 8]
    f[1, 1, 1] = d37[[1]];
    f[1, 1, 0] = d37[[2]];
    f[1, 0, 1] = d37[[3]];
    f[1, 0, 0] = d37[[4]];
    f[0, 1, 1] = d37[[5]];
    f[0, 1, 0] = d37[[6]];
    f[0, 0, 1] = d37[[7]];
    f[0, 0, 0] = d37[[8]];
    g[x_] := Mod[f[x[[2]][[1]], x[[2]][[2]], x[[2]][[3]]] + x[[1]][[2]],2]

Here x is a list of the current and of the previous step 3-neighborhoods.Then I can plot the time evolution starting, for instance, from {{0,1,0},{0,1,0}} surrounded by zeros

    ArrayPlot[CellularAutomaton[{g[#] &, {}, 1, 2}, {{{1}, {1}}, 0}, 200]]     

37R simple evolution

Probably it can be simplified and adapted for other ECA. The rule 150 (with Total) from the documentation is not a good example for a general reversible automaton function.


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.