Message Boards Message Boards

Conway's structures

GROUPS:

Recently I noticed here a thread about gliders:

http://community.wolfram.com/groups/-/m/t/1120326

I must say that I have virtually almost no idea about "cellular autmatons" ("automata"?), but it reminded me about a book I have read quite a time ago (1979?).

Manfred Eigen, Ruthild Winkler: "Das Spiel, Naturgesetze steuern den> Zufall" ( ISBN 3-492-02331-2)

Manfred Eigen is a Nobel-Prize -Winner of 1967 in Chemistry ( for his work about very fast chemical reactions).

In this book several biochemical models are mentioned, which, as it seems, can well be described by cellular automata.

It is mentioned, that a lot of patterns with remarkable behaviour are described by Martin Gardner in "Mathematical Games" , Scientific American, Oct. 1970 and Feb. 1971 (citations given in the aforementioned book).

As I said I am a newby about cellular automata, and so I decided to write a procedure (in Mma 7) which is able to display a "gun", that is a device which emits periodically a glider, and an "eater" , which destroys the arriving glider. See the notebook attached.

First an oscillator and a glider are constructed and displayed, then the gun and eater, and finally both together.

I haven't looked at the behaviour of the system when the the patterns are shifted, but that could be easily done because I have provided a code which allows for translations.

Have a look at it, any comments are welcome.

Attachments:
POSTED BY: Hans Dolhaine
Answer
2 months ago

More interesting structures which can be easily coded (note that in the program you give the coordinates of occupied cells as an unstructured list; so if {1,1}, {5,2} and {3,9} are the positions of an object you put in { 1,1,5,2,3,9 } ) are given on these web-sites

https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

https://de.wikipedia.org/wiki/Conways_Spiel_des_Lebens#Conways_Herausforderung

POSTED BY: Hans Dolhaine
Answer
2 months ago

In the meantime I figured out how to get the results given in the notebook with the Mma-built-in cellular automata (apart from the direction of the graphics). Two problems remain: how to explain the code 224 for Conways Game Of Life, and how could one assign different colors to different objects in the combined graphics. I tried to do it with a ColorFunction depending on x and y, but to no avail.

So for the cellular automata define the gun and the eater as

gundat = {
   7, 2, 8, 2, 7, 3, 8, 3,
   7, 13, 8, 13, 9, 13,
   6, 14, 10, 14,
   5, 15, 11, 15, 6, 16, 10, 16,
   7, 17, 8, 17, 9, 17,
   7, 18, 8, 18, 9, 18,
   5, 23, 6, 23, 7, 23,
   4, 24, 5, 24, 7, 24, 8, 24,
   4, 25, 5, 25, 7, 25, 8, 25, 4, 26, 5, 26, 6, 26, 7, 26, 8, 26,
   3, 27, 4, 27, 8, 27, 9, 27, 7, 32, 8, 32, 5, 36, 6, 36, 5, 37, 6, 
   37};

eaterdat = {
   3, 2, 3, 3, 2, 4, 4, 4, 3, 5, 3, 6, 3, 7, 3, 8, 2, 9, 4, 9, 3, 10, 
   3, 11};

Here are the functions do convert the data to elements of a sparse array ( tx and ty shift the data in x- and y-direction)

gun[tx_, ty_] :=  SparseArray[  Rule[#[[1]], #[[2]]] & /@ ({{tx, ty} + #, 1} & /@ Partition[gundat, 2]), {nx, ny}]
eater[tx_, ty_] :=  SparseArray[  Rule[#[[1]], #[[2]]] & /@ ({{tx, ty} + #, 1} & /@ Partition[eaterdat, 2]), {nx, ny}]

Now define the "playground"

nx = 40; ny = 50;
gun0 = Normal[gun[0, 0]];
eater0 = Normal[eater[25, 35]];

and get the gun (in Red thanks to the ColorRules)

gunplt = ListAnimate[  ArrayPlot[#, ImageSize -> 400, Mesh -> True, ColorRules -> {1 -> Red}] & /@ 
   CellularAutomaton[{224, {2, {{2, 2, 2}, {2, 1, 2}, {2, 2, 2}}}, {1,1}}, {gun0, 0}, 80]]

and the eater in black

eaterplt = 
 ListAnimate[ ArrayPlot[#, ImageSize -> 400, Mesh -> True] & /@ 
   CellularAutomaton[{224, {2, {{2, 2, 2}, {2, 1, 2}, {2, 2, 2}}}, {1,1}}, {eater0, 0}, 80]]

To put gun and eater in one display just add the matrices (which gives rise to the problems with coloring)

mm = gun0 + eater0; 
allplt =  ListAnimate[
  ArrayPlot[#, ImageSize -> 400, Mesh -> True] & /@ 
   CellularAutomaton[{224, {2, {{2, 2, 2}, {2, 1, 2}, {2, 2, 2}}}, {1,1}}, {mm, 0}, 80]]

Question: how to assign different colors to gun and eater?

POSTED BY: Hans Dolhaine
Answer
2 months ago

Found a solution. But are there more elegant, meaning less memory-consuming ones?

gg = CellularAutomaton[{224, {2, {{2, 2, 2}, {2, 1, 2}, {2, 2, 2}}}, {1, 1}}, {gun0, 0}, {80, {1, nx}, {1, ny}}];
ee = CellularAutomaton[{224, {2, {{2, 2, 2}, {2, 1, 2}, {2, 2, 2}}}, {1, 1}}, {eater0, 0}, {80, {1, nx}, {1, ny}}] /.  1 -> -1;


allplt1 = 
 ListAnimate[
  ArrayPlot[#, ImageSize -> 400, Mesh -> True,  ColorRules -> {1 -> Red, -1 -> Blue}] & /@ (gg + ee)]
POSTED BY: Hans Dolhaine
Answer
2 months ago

Group Abstract Group Abstract