Game of Life, Part 1, The Rule
Contents
The Rule
The "Game of Life" was invented by John Horton Conway, a British-born mathematician who is now a professor at Princeton. The game made its public debut in the October 1970 issue of Scientific American, in the Mathematical Games column written by Martin Gardner. At the time, Gardner wroteThis month we consider Conway's latest brainchild, a fantastic solitaire pastime he calls "life". Because of its analogies with the rise, fall and alternations of a society of living organisms, it belongs to a growing class of what are called "simulation games"--games that resemble real-life processes. To play life you must have a fairly large checkerboard and a plentiful supply of flat counters of two colors.
Today Conway's creation is known as a cellular automaton and we can run the simulations on our computers instead of checkerboards. The universe is an infinite, two-dimensional rectangular grid. The population is a collection of grid cells that are marked as alive. The population evolves at discrete time steps known as generations. At each step, the fate of each cell is determined by the vitality of its eight nearest neighbors and this rule:- A live cell with two live neighbors, or any cell with three live neighbors, is alive at the next step.
Block
If the initial population consists of three live cells then, because of rotational and reflexive symmetries, there are only two different possibilities; the population is either L-shaped or I-shaped.
Blinker

Glider

Infinite Universe
So how, exactly, does an infinite universe work? The same question is being asked by astrophysicists and cosmologists about our own universe. Over the years, I have offered three different MATLAB Game of Life programs that have tackled this question three different ways. The MATLAB /toolbox/matlab/demos/ directory contains a program life that Ned Gulley and I wrote 20 years ago. This program uses toroidal boundary conditions and random starting populations. These are easy to implement, but I have to say now that they do not provide particularly satisfactory Game of Life simulations. With toroidal boundary conditions cells that reach an edge on one side reenter the universe on the opposite side. So the universe isn't really infinite. And the random starting populations are unlikely to generate the rich configurations that make Life so interesting. A few years ago, I published the book Experiments with MATLAB that includes a chapter on Game of Life and a program lifex. The program reallocates storage in the sparse data structure as necessary to accommodate expanding populations and thereby simulates an infinite universe. The viewing window remains finite, so the outer portions of the expanding populating leave the field of view. The starting populations for lifex are obtained from the Life Lexicon, a valuable resource cataloging several hundred terms related to the Game of Life. Life Lexicon includes over four hundred interesting starting populations. You can also visit a graphic version of the Lexicon. My latest program, which I am describing in this and later posts of this blog, uses the same dynamic storage allocation as lifex. But it features an expanding viewing window, so the entire population is always in sight. The individual cells get smaller as the view point recedes. The program also accesses Life Lexicon, so I've named it life_lex. It is now available from the MATLAB Central File Exchange; see the submission Game of Life. The static screen shot and the movies in this post are from life_lex.Full Screen Video Playback
I had hoped to capture the output from life_lex in such a way that you could play it back at a reasonable resolution and frame rate. But that involves video codecs and YouTube intellectual property agreements and all kinds of other stuff that I did not want to get involved in for this week's blog. Maybe later. It is easy to insert half a dozen lines of code into a MATLAB program to produce animated GIF files -- an ancient technology that is good enough for our purposes today. But it is not practical to capture every step. The resulting .gif files are too large and the playback is too slow. However the following two examples show it is possible to produce acceptable movies by not recording every frame.Glider Gun

Noah's Ark
I think this is an amazing evolution. The Lexicon saysThe name comes from the variety of objects it leaves behind: blocks, blinkers, beehives, loaves, gliders, ships, boats, long boats, beacons and block on tables.
We've learned about a few of these things -- blocks, blinkers, and gliders. But what are the others? Welcome to the world of the Game of Life. For this movie I've captured every 50th step of 2000 steps. You can see why the expanding universe and the life_lex resizing are necessary, Noah's Ark Movie.- Category:
- Matrices
Comments
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.