The concept of the Game of Life is very simple. The game takes place over the cells in an array, like squares on a chessboard. Each cell can have an organism living inside it or not living inside it; or each cell itself can be alive or dead. Whatever frame of thought is used, each cell is described to be "on" or "off." At the beginning of the game, a certain number of cells are filled.
MethodologyThen the game begins. Every clock-tick, a new generation of cells is created. A set of rules is applied to each cell in the array to determine what will happen to the cell in this next generation. The rules are as follows:
- If a cell is off and has three neighbors around it which are on, then the cell becomes on.
- If a cell is on and has one or less neighbors around it which are on, the cell dies of loneliness (it becomes off).
- If a cell is on and has more than three neighbors around it which are on, the cell dies of overcrowding.
The game of life is a zero player game devised by mathematician John Horton Conway and explained by Scott E Page on the Coursera website in one of the videos on model thinking. The game is a grid of cells and each cell has a 'on' and a 'off' state or in other words, an 'alive' or 'dead' state. It has simple rules that can create complex patterns over time. If a cell is alive, then it can continue to 'live' only if it has exactly 2 or 3 neighboring cells alive, else it dies or goes 'off'. A dead cell can come alive only if it has exactly 3 neighboring cells alive. Over time, this creates intricate patterns and even animations! Certain patterns create 'blinkers' or even spawn into many more cells and spread across the grid.
1. Initial State
2. Growth of Cell
Other interesting patterns can be developed too.
Here is the link for the JQuery Implementation.