This is a simple implementation of British mathematician John Conway's Game of Life.
Each square in the grid represents a cell that can either be dead (blank white square) or alive (filled with a black circle). You can click on a square to toggle its starting state between alive or dead. After hitting "Start", the simulation will proceed and cells will change between alive or dead based on its 8 neighboring cells according to the following rules:
- A live cell dies due to underpopulation if it has less than two living neighbors
- A live cell dies due to overpopulation if it has more than three living neighbors
- A live cell with two or three living neighbors is stable and survives to the next cycle
- A dead cell with exactly three living neighbors becomes a live cell due to reproduction
In this implementation, any imaginary cells beyond the grid are considered uninhabitable and can never support life. So, for example, the cell in the top right of the grid will always have at least five dead neighbors due to the cells above and to the right of it being uninhabitable.
After clicking on some initial live cells, click the "Start" button to begin the simulation. The counter under the grid will track the progression of cycles. You can hit the "Stop" button to pause the simulation and make changes to the grid or hit the "Reset" button to return the grid to a blank slate and return the cycle counter to 0.
If you want to let the simulation proceed for only a single cycle, you can hit the "Step 1 Cycle" button.
You can read more about Conway's Game of Life and find some starting patterns to play with <here>
