In 1970, British mathematician John Horton Conway invented a zero-player mathematical game that stunned the world: The Game of Life.
Life takes place on a two-dimensional grid of cells, each of which is either alive or dead. Every cell interacts with its $8$ immediate neighbors (horizontally, vertically, and diagonally).
At each time step, all cells transition simultaneously according to four simple rules:
Underpopulation: Any live cell with fewer than $2$ live neighbors dies (as if by underpopulation).
Survival: Any live cell with $2$ or $3$ live neighbors lives on to the next generation.
Overpopulation: Any live cell with more than $3$ live neighbors dies (as if by overcrowding).
Reproduction: Any dead cell with exactly $3$ live neighbors becomes a live cell!
The Wonder of Emergent Complexity
From these elementary rules arises astonishing mathematical behavior:
Still Lifes: Stable configurations that never change (e.g. Block, Beehive).
Oscillators: Patterns that repeat in a rhythmic cycle (e.g. Blinker, Beacon, Pulsar).
Spaceships: Self-propelling entities that travel across the grid forever (e.g. the Glider)!
Mathematicians have even proven that Conway's Game of Life is Turing Complete — you can build logic gates, binary counters, and simulate an entire computer inside it!
Move the mouse over a dotted box for more information.
Interactive Drawing: You can click and drag with your mouse directly on the grid to create or erase living cells while the simulation is running!
Toolbar Controls: Use the Play/Pause, Step, and Clear buttons above the canvas to control time.
Toroidal Universe: The edges of the grid wrap around seamlessly (top connects to bottom, left connects to right).
Now you try. Run the simulation, then draw a 3x3 square of live cells with your mouse and watch what happens!
Type your code here:
See your results here:
The code has ???? for the glider position. Replace ???? with 6, 6, then click Run to watch life evolve in the viewport!
1. Watch the Glider in the upper-left march diagonally across the universe!
2. Observe the Pulsar in the center pulsing with a period of 3 generations.
3. Draw with your mouse: Click anywhere on the grid to toggle cells alive or dead.
Share your code
Show a friend, family member, or teacher what you've done!