Message Boards Message Boards

0
|
5287 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

How to build Conway's Game of Life?

Posted 9 years ago

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!

POSTED BY: Luigi P
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 = 
{{1,4},{2,5},{3,1},{3,5},{4,2},{4,3},{4,4},{4,5},
{8,1},{9,2},{9,3},{10,3},{11,3},{12,2},{15,1},{15,4},
{16,5},{17,1},{17,5},{18,2},{18,3},{18,4},{18,5}};

Precompute 100o steps of evolution outside animating module:

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

Animate showing trails of past generations:

Manipulate[

 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

Hi,

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.

Cheers,

Marco

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

Group Abstract Group Abstract