Cellular Automata and Game of Life.

As a part of the digital visualisation module with the M.Res Programme, we were building cellular automata models with processing. The exercise was really interesting especially the Conway’s game of life where small amount of rules and coding generates a animation which is sometimes rich and endless. To be more specific the model is set in a plain canvas which is divided into equal grids and each cells is either alive/dead. There are three rules

  1. If the number of neighboring cells (n) of a cell is less than the loneliness limit then an alive cell dies
  2. If n is more than the overcrowding limit then an alive cell dies
  3. If n is equal to the creation condition then a dead cell becomes alive and rest stays the same.

I was experimenting with the same model and was trying to create something out of the game of life model by changing some of its rules. The results are as below,

1) Original Game of life:

Here the parameters are, loneliness limit = 2, Overcrowding limit = 3 and the creation condition = 3. This is by far the most interesting set of parameters which creates a life like situation where organic patterns emerge and spread and die. It even results in some mobile ‘organisms’ which can move along the canvas.

2) Space Filling Fractal:

Here the parameters are – Loneliness limit = 2, Overcrowding limit = 1 and the creation condition = 5. When the initial condition is a alive cell in the sides of the canvas (not the corners), the alive cell goes on to create a fractal growth which kind of fills up the space.

3) Sierpinski’s Gasket:

Here the parameters are – Loneliness limit = 2, Overcrowding limit = 2 and the creation condition = 1. When the initial condition is such that all the cells in the diagonals are alive, it goes on to create a Sierpinski’s gasket in the corners of the canvas.

4) Growth and Edges:

Here the parameters are varied through out the simulation and it shows how an object can be created by using a normal initial condition and using a combination of parameters (please note that the parameters are actually changing during the video) which are controlled manually. Even the edges of the object generated can be isolated by just changing parameters.

The code which resulted in the above videos can be downloaded here. The instructions are as below

  • press ‘r’ to reset the canvas to blank.
  • press ‘u’ to start or stop the simulation.
  • click and drag in the canvas to introduce alive cells.
  • press ‘a’ to introduce alive cells all  along the mid points, press ‘s’ to introduce alive cells along the diagonals and press ‘x’ to introduce both.
  • press ‘-‘ or ‘+’ to decrease or increase the overcrowding limit and press ‘[‘ or ‘]’ to decrease or increase the creation limit.

Have fun. p.s You need to have processing to run the above code. which can be downloaded here.

Leave a Reply