Dr Conway's Life Game [40B - 60C]
Contributed by Francis Glassborow
Of all the automata games this is probably the best known. Its universe is a two dimensional grid of cells that can be in one of two states (alive or dead). A cell is deemed as a neighbour if it is a Chess King's move away; i.e. if it is adjacent either orthogonally or diagonally. The rules for generating the next generation are simple. Cells with three live neighbours are unconditionally alive in the next generation, ones with exactly two neighbours remain unchanged and all others are dead.
If you would like to know more about 'Life' a good place to start would be
here.
Now if you have done a bit of surfing based on the above link you will realise that the obvious programming based on Life has already been done. However there are several things that you can do both to vary the view and modify the 'universe'. Note that you really do need a graphics library for the language you are using because all worthwhile projects based on Life require a good quality display. Here are a few ideas:
- Write a program that displays the cells as blocks. I.e. instead of displaying each cell as one or more pixels use one (or a block of) pixels to display the status of a square block of life cells. Vary the colour of the display to represent the number of live cells in the block. You should be able to zoom out so that a pixel represents ever larger blocks of cells. The resulting program is an excellent simulation of science. Set to a fairly large zoom (shall we say each pixel represents the status of 25 cells (and so can be in twenty five colours) let a long term pattern run and ask the audience to explain what is happening. Progressively zoom in. Only when we get down to a pixel representing a single cell will the underlying rules become clear.
- Write a program that displays cells coloured according to the length of time they have been alive. Now allow them to die from old age, i.e. that there is a progressive chance that a cell will spontaneously die depending on how long it has been alive, the older it is the higher the chance it dies. Add in spontaneous life for a cell, but make the chance very low.
- Convert your 'universe' into a torus by making the opposite edges adjacent. There are various different rules you can use for this 'joining' of opposite edges such as offsetting the join by one or more cells. There are many other topologies that you can explore.
Program elements
You will need to develop your understanding of mechanisms for storing and processing large volumes of simple data. The second project above will require some understanding of suitable random number and pseudo random number generation.