Skip to main content
2 of 2
deleted 3 characters in body
arkajad
  • 591
  • 1
  • 4
  • 13

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]
    Clear[f]
    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.

arkajad
  • 591
  • 1
  • 4
  • 13