The Game of Life is a simulation developed by John Conway in 1970. A square grid represents the universe, and each cell represents a living or dead entity. For each generation, a set of rules determines whether each cell lives or dies. Despite the simplicity of the rules, the program yields complex patterns.
The challenge is to make this software efficient. The trick is to keep track of which cells change. For the next generation, the program only needs to evaluate the changed cells and their neighbors.
Rules
A cell has 8 neighbors, 2 horizontally adjacent, 2 vertically adjacent, and 4 diagonally adjacent.
- All dead cells with 3 live neighbors are born.
- All live cells with 2 or 3 neighbors survive.
- All live cells with less than 2 neighbors die of loneliness.
- All live cells with more than 3 neighbors die of overpopulation.
Screen Shot
See Also
