Notes

Chapter 3: The World of Simple Programs

Section 3: Mobile Automata


Implementation of generalized mobile automata

The state of a generalized mobile automaton at a particular step can be specified by {list, nlist}, where list gives the values of the cells, and nlist is a list of the positions of active cells. The rule can be given by specifying a list of cases such as {0,0,0}->{1,{1,-1}}, where in each case the second sublist specifies the new relative positions of active cells. With this setup successive steps in the evolution of the system can be obtained from

GMAStep[rules_, {list_, nlist_}] := Module[{a, na}, {a, na} = Transpose[Map[Replace[Take[list, {#-1, #+1}], rules]&, nlist]]; {Fold[ReplacePart[#, Last[#2], First[#2]]&, list, Transpose[{nlist, a}]] ,Union[Flatten[nlist + na]]}]


From Stephen Wolfram: A New Kind of Science [citation]