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.


Accidents in United Kingdom over 2010 – Animation

Continuing from the last post, this is a visualization of essentially the same data but with a temporal element as well. The video below shows the occurrence of road accidents in UK during 2010 as it happened in time. Each frame in the video adds an hour of accidents to the canvas as bright blue dots and a second in the video is equivalent to 2 days in real time. The light blue shadow is left behind by previously occurred accidents building a cumulative map. As before, the animation is built with processing + blender and the data is cleaned with R and excel. To be honest there nothing much to observe and infer from the visualization at this level except for the small breathing effect which may be due to the peak hours and nights in traffic and how the accident locations correlates with heavily populated areas with dense roads. The video is embedded below and I would recommend increasing the HD setting to 720p for a good quality, comprehensible video.

The source for the data is from UK Data service at here.

Accidents in UK – Initial Visualization

As a part of the data collection for the dissertation, I just got my hands on a huge set of records detailing every accident happened in 2010 within UK and as the first step towards interpreting the data I tried to map of all the accidents recorded as points in their relative locations. After 2-3 hours of struggle with R [for data cleaning] and processing [for visualization , the final result is as below. The map below shows every accident recorded in UK in 2010 as a cyan dot mapped in the canvas relative to each other (approx. not to scale). Though there is already lot of work done in visualizing this data set [1] [2] [3] [4] [5] , I think this is a solid first step for me explore and build confidence in this area. This being a start I think i’ll be posting a lot of similar stuff here as the dissertation progresses.


The source for the data is from UK Data service at here. [note: Click the image for a larger version of the map]