Michal Paszkiewicz


An alteration of Conway's game of life

A colleague of mine, James Johnstone, recently created his website with lots of goodies in it! One of my favourites is his implementation of Conway's game of life. Not only is it neat and pretty, but the code is (as always) exceptionally good and clear and uses some of my favourite technologies - html 5 canvas and angular js!

What is Conway's game of life?

Conway's game of life is a cellular automaton devised by the British mathematician John Horton Conway. It is not a game as such - it is a model that follows some particular rules that make the state change every x amount of time. Conway's original rules are the following:

  1. Any live cell with fewer than two live neighbours dies of loneliness :'(
  2. Any live cell with two or three live neighbours lives on to the next generation.
  3. Any live cell with more than three live neighbours dies, as if by overcrowding.
  4. Any dead or empty cell with exactly three live neighbours becomes a live cell, as if by reproduction.

The interesting thing about these rules, is that they usually result in some stable states that either do not change, or repeat over a set period of time. This is interesting, as it is possible to characterise the stable constructions in the game and study them in terms of interactions with each other. The standard version can be looked at here.

My "war" variation

Having looked at James' implementation I was impressed by how much choice you had - with changing the size, speed and population density. But I couldn't help but wander what would happen if you changed more.

So, I have implemented a new variation, where you can add different races (cells with other colours) that can also have different values for reproduction and under and overpopulation. Then I added an extra rule.

  • If a live cell has neighbours of a rival cell culture which have a total strength greater than the total strength of the friendly (similar) cell neighbours, the cell will turn into an enemy cell, as if eaten or taken over.

So now I have the Game of life with various cell races that can fight each other. Something I pretty soon discovered is this: in the normal game of life, setting different values results in quite boring formations. However, when there are 2 or more races, changing the various values for the behaviour of the cells of the different races can result in very interesting consequences.

While using my "war" variation, the following settings will make a race behave with the normal game of life principals:

  • Underpopulation: 2
  • Reproduction: 3
  • Overpopulation: 4
  • Strength: 0
  • Colour: ANYTHING_YOU_WANT (please note, 'ANYTHING_YOU_WANT' won't work, so please try to use a real colour)
If you have multiple races with the above settings, you will have multiple races playing the standard rules of the game of life and will treat other races in the same way that they treat walls.

As soon as a strength is turned on, the race with the greater strength will in general start consuming cells of a lower strength (unless outnumbered by cells with a lower, but bigger than 0 strength).

The more interesting results, however, stem from changing multiple values. One of my favourite settings is the following.

Set one race to:

  • Underpopulation: 1
  • Reproduction: 3
  • Overpopulation: 7
  • Strength: 3
  • Colour: lightblue

And set a second race to:

  • Underpopulation: 2
  • Reproduction: 3
  • Overpopulation: 4
  • Strength: 5
  • Colour: grey

Now click reset a few times till you start seeing interesting things happen.

What is happening here, is that the lighblue race is not dying as much due to under and overpopulation as the greys are. This means it grows a lot faster due to population. However, the grey race is strong, so will consume cells of the lighblue race. What usually now results is that the lightblues grow very fast and get eaten by the greys. The greys then settle into their stable states, which have a low population density, meaning there is more space for the lightblues to expand into and so the cycle goes on.