Message Boards Message Boards


How to build Conway's Game of Life?

Posted 8 years ago
2 Replies
1 Total Likes

Hello, I am in search for a way to build the Game of Life with Wolfram Language (I use the free cloud programming).

I read this page, but using that code creates only an image while I'm searching for an animated one. I tried to implement the code found at page 40 of Professor Gaylord's PDF, but I was not able to.

I'm only a student and if someone could help with the code I would be immensely grateful. We study Java at school, so this is the only place where I can ask I believe. I don't need anything fancy like custom seeds and speed change, a simple thing that just reproduces the basic Game of Life is more than enough.

Thanks in advance to anyone who bothers to bear with my egoistic request!

2 Replies

There are numerous examples at Wolfram Demonstrations project, even some by Stephen Wolfram:

enter image description here

So, download code and study them. Here is one version out of many. Rule:

GameOfLife = {224, {2, {{2, 2, 2}, {2, 1, 2}, {2, 2, 2}}}, {1, 1}};

Puffer initial state:

Puffer = 

Precompute 100o steps of evolution outside animating module:

evo = N@CellularAutomaton[GameOfLife, {SparseArray[Puffer -> 1], 0}, 1000];

Animate showing trails of past generations:


 ArrayPlot[Mean@evo[[t ;; t + 200]], ImageSize -> 800, Frame -> False,
   ColorFunction -> "TemperatureMap", PlotRangePadding -> 0],

 {{t, 1, "steps"}, 1, 800, 1, Animator, AnimationRate -> 60, 
  AnimationRunning -> False}, FrameMargins -> 0]

enter image description here

POSTED BY: Vitaliy Kaurov


if you can create an image it is not too difficult to make an animation make a table, ie a sequence, of images and ListAnimate them. You can also export them in many different formats.



POSTED BY: Marco Thiel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract