Firstly, this isn’t about the life we live, but rather Conway’s Game of Life. (Go ahead and read that, there’s no real reason for me to retype all of it here — and there’s some cool graphics that show it all playing out)

The rules are simple. It’s played on a grid of “cells,” each of which can be alive or dead.

  • If a dead cell has exactly three live neighbors then it comes to life
  • If a live cell has two or three live neighbors it stays alive.
    • Too many and it dies of overpopulation
    • Too few and it dies of loneliness

Each generation of cells simply applies these rules to generate the next generation.

A simple way of implementing this is to double-buffer the boards. One of these buffers stores to the current board and you generate the next generation on the other one. The reason you need two in this case is because you can’t modify the board you’re working on. (think what would happen if you kill off a cell before you evaluate its neighbor) When you’re done constructing the new generation, you simply repeat the process with the boards’ roles reversed.

This works, but there’s plenty of room for improvement.

The obvious problem with this is that you need twice the memory to process all of this. This isn’t an overwhelming problem when you’re looking at a glider, but when you try to make a full computer out of it… well it starts getting a bit hairy.

The other parts you can optimize aren’t so readily apparent. We’ll get there in the next couple of days.

Tomorrow: How XLife added a layer of speed to the process!