Conway's Game of Life



Conway's Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. After the initial configuration has been created the rules are followed and one observes how it evolves.
The Game of Life is composed of a grid of square cells, each of which is in one of two possible states, alive or dead. Every cell interacts with its eight neighbors, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time the following transitions occur:
  1. 1. Any live cell with fewer than two living neighbors dies, as if caused by under-population
  2. 2. Any live cell with two or three live neighbors lives on to the next generation.
  3. 3. Any live cell with more than three live neighbors dies, as if by overcrowding.
  4. 4. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
Usually, live cells are colored and dead cells are white, making it easy to see what the current state of the game is. This application uses an image as the initial state of the game and uses different rules to determine if a cell (or pixel) is alive or dead.
Each pixel's color is represented by three numbers representing the red, green, and blue components, using the RGB color model each component ranges from 0 to 255.
There are many ways we can choose to determine if a pixel is alive or dead. For example, we could call a pixel alive if one of the components is above an arbitrary number. We could say any pixel that has a red component above 200 is alive. This makes an easy visual representation of the cells with more red are alive. Or we could call a pixel alive if one of the components is divisible by a specific number. This looks more arbitrary, but causes more interesting animations when the game of life is simulated.
To make the animation look smooth when simulated I look for a neighbor that is in the state a cell is changing to. When a cell is dying it takes the color if a dead neighbor, and when a cell is being born it takes the color of a live neighbor. If there are no such neighbors then I break the rule and don't change the pixel's state that round.
You can start and stop the simulation by clicking on the big picture. When you select a small picture it will auto start the simulation. You can also supply your own picture by entering a url and pressing the "Use Custom" button.