Mobile automata [emulating cellular automata]
Given the rules for an elementary cellular automaton in the form used on page 867, the following will construct a mobile automaton which emulates it:
vals = {x, p[0], q[0, 0], q[0, 1], q[1, 0], q[1, 1], p[1]}
CAToMA[rules_] := Table[(# Replace[#, {{q[a_, b_], p[c_], p[d_]} {q[c, {a, c, d} /. rules], 1}, {q[a_, b_], p[c_], x} {q[c, {a, c, 0} /. rules], 1}, {q[_, _], x, x} {p[0], -1}, {q[_, _], q[_, a_], p[_]} {p[a], -1}, {x, q[_, a_], p[_]} {p[a], -1}, {x, x, p[_]} {q[0, 0], 1}, {_, _, _} {x, 0}}]) &[vals〚IntegerDigits[i, 7, 3] + 1〛], {i, 0, 73 - 1}]
The ordering in vals defines a mapping of symbolic cell values onto colors. Given a list of initial cell colors for the cellular automaton, the initial conditions for the mobile automaton are given by Flatten[{p[0], Map[p, list], p[0]}] surrounded by x's, with the active cell being placed initially just before the first p[0].