Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is there a three-dimensional cellular automaton that in some sense generalizes Conway's Game of Life? If so, how might we use the CellularAutomaton command to simulate it? How might we visualize it?

share|improve this question
2  
Your question has been closed once because the way you've phrased it is not particularly appropriate for the site; StackExchange sites are not discussion forums, so questions are expected to be more specific and directed. I voted to re-open since clearly it is possible to give a good answer to the question, but we would all appreciate it if you could revise your post into something more suitable for a question-and-answer format. The principal difficulty is that people are expected to vote on the answers, and unless specific criteria are given, it is hard to know how to do so. –  Oleksandr R. Jul 20 at 4:00

1 Answer 1

Conway's game of life is a 2D, two-state, outer totalistic, cellular automaton. I guess the natural thing is to try such CAs in 3D. Here's the evolution of one such CA:

twos = Array[2 &, {3, 3}];
twosWithOne = twos;
twosWithOne[[2, 2]] = 1;
outerTotalisticCA3D[ruleNumber_Integer, 
  duration_Integer, init_List] := 
 CellularAutomaton[
  {ruleNumber,
   {2, {twos, twosWithOne, twos}},
   {1, 1, 1}
   },
  {init, 0},
  duration,
  {{0, duration}, Automatic}]
SeedRandom[5];
init = RandomInteger[{0, 1}, {20, 20, 20}];
pics = Image3D /@ outerTotalisticCA3D[47104, 42, init];
ListAnimate[pics]

enter image description here

Most of this is fairly straightforward and explained well in the documentation on CellularAutomaton. The tricky part is the rule specification here:

  {ruleNumber,
   {2, {twos, twosWithOne, twos}},
   {1, 1, 1}
  }

In this bit of code, the {1,1,1} specifies that the neighborhood should have radius 1 in each direction; that list has length three, since we're working in 3D. The 2 in {2,{twos, twosWithOne, twos}} specifies that we've got two states, live or dead. The {twos, twosWithOne, twos} is a $3\times 3\times 3$ block of integers, all of which are 2 except the central entry which is a 1. The rule depends on the sum of the entries corresponding to the twos; the central entry is special. Thus, the state of a cell at time $t$ depends on the state of the cell at time $t-1$, together with the sum of the states neighboring cells at time $t-1$. This is exactly what it means to say that we're dealing with an outer totalistic rule. Since there are 26 neighboring cells, there are 27 possible values of the sum, i.e. anything between 0 and 26 inclusive. There are also two possible states for the central cell, so there are up to $2^{2\times27}$ total such rules.

According to a nice analysis in this paper, rule 47104 is the most "life like" of all the potential 3D life rule and, in fact, we see a characteristic glider appearing in this animation. The paper denotes this by rule $(5766)$, meaning that a live cell stays alive if it has precisely 5, 6, or 7 live neighbors and a dead cell springs to life if it as precisely 6 live neighbors. We can generate the rule number in Wolfram's scheme as follows:

live = dead = Table[0, {27}];
live[[6]] = live[[7]] = live[[8]] = dead[[7]] = 1;
rule = FromDigits[Reverse[Riffle[dead, live]], 2]
(* Out: 47104 *)

More generally, live and dead should be $0-1$ lists of length 27; the element in position $j$ of the live list indicates the subsequent state of a live cell, assuming the sum of its neighbors is $j-1$, and similarly for the dead list.

share|improve this answer
    
Thanks for the +1 edit –  eldo Jul 18 at 22:44
    
@eldo And thank you. It is definitely more life like, now. :) –  Mark McClure Jul 18 at 22:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.