Conway’s Game of Life Simulator
A live, editable implementation of Conway’s Game of Life running on a wrapping grid in your browser. Load a starting pattern, set the generation rate, and watch the automaton run — or drag on the canvas to draw your own cells into a running field and see how far the disturbance travels. The JavaScript that produces it is on the page in an editor, so you can change the rule itself and watch a different universe appear.
The Game of Life is not a game and has no players. It is a two-dimensional cellular automaton devised by John Conway in 1970, and it is the standard example of how a rule small enough to write on one line produces behaviour rich enough to be Turing complete.
The Rule: B3/S23
Every cell is alive or dead. Each generation, every cell counts its eight neighbours — orthogonal and diagonal — and applies one rule:
- Birth: a dead cell with exactly 3 live neighbours becomes alive.
- Survival: a live cell with 2 or 3 live neighbours stays alive.
- Death: every other cell is dead next generation — fewer than 2 neighbours is underpopulation, more than 3 is overcrowding.
In code that is a single expression:
next[i] = (n === 3 || (n === 2 && grid[i])) ? 1 : 0;
The shorthand B3/S23 means “born on 3, survives on 2 or 3”. The notation exists because the same machinery runs any rule you care to name: B36/S23 is HighLife, which has a self-replicating pattern; B1/S1 produces fractal replicators; B5678/S45678 is a majority-vote rule that forms blobs. Change two characters in the editor and you are simulating a different universe.
Two implementation details are not optional, and both are common bugs in first attempts:
- The next state must go into a second array, with the two arrays swapped at the end of the pass. Updating in place lets a cell count neighbours that have already advanced to the next generation, which silently produces a different, non-Life automaton.
- The grid wraps — the row above the top row is the bottom row, and the column left of the first is the last. This makes the surface a torus, gives every cell exactly eight neighbours, and removes edge special-casing entirely.
The Starting Patterns
| Pattern | What it is | What to watch |
|---|---|---|
| Random soup | A random field at your chosen density | Most of it dies within about 20 generations; what remains is almost entirely blocks, beehives, blinkers and gliders |
| Gosper glider gun | The first known pattern with unbounded growth | Fires a glider every 30 generations, forever. Slow the rate right down to see the collision on the left that produces each one |
| Pulsar | A period-3 oscillator | The best correctness test there is — an off-by-one in the neighbour count usually kills it within a generation or two |
| R-pentomino | Five cells | Churns chaotically for 1,103 generations before settling. Five cells, a thousand generations of unpredictable behaviour |
| Acorn | Seven cells | 5,206 generations, and it spreads across a far larger area than seems possible |
The vocabulary that emerges from a random soup is worth naming, because it is the same in every run. Still lifes never change: the block (2×2), the beehive, the loaf, the boat. Oscillators repeat with a fixed period: the blinker (three in a row, period 2), the toad (period 2), the pulsar (period 3). Spaceships translate across the grid: the glider moves one cell diagonally every four generations, and the lightweight spaceship moves horizontally. Gliders matter beyond aesthetics — they are the signal wires in Life-based computers, and the gun that emits them is what proved unbounded growth possible, settling Conway’s original open problem.
Controls
- Starting pattern — random soup, Gosper glider gun, pulsar, R-pentomino or acorn.
- Generations per second — 1 to 60. Low values are for watching mechanism; high values are for watching a soup settle.
- Cell size — 2 to 16 pixels. Smaller cells mean a larger grid and more room for patterns to develop before they interfere with themselves across the wrap.
- Soup density — the initial live fraction, 5% to 70%. The interesting regime is around 30%; very high densities die back almost immediately from overcrowding.
- Hue and afterglow — colour, and whether dying cells leave a fading trail that makes the motion of gliders far easier to follow.
- Draw on the canvas — drag to inject live cells into a running simulation.
The simulator is a live JavaScript canvas sandbox: the source is editable on the page, changes run immediately, and you can download the whole thing as a single self-contained HTML file to keep or modify offline.
Why It Matters
Life is Turing complete. Anything a computer can compute can be computed by an initial arrangement of cells — people have built logic gates from glider collisions, memory from oscillators, and a working universal Turing machine, plus a pattern that simulates Life itself. That result is the sharpest available illustration of emergence: the rule contains no notion of a glider, a gun or a computer, yet all of them exist as consequences of it. The same idea underpins reaction-diffusion models of animal markings, lattice-gas approaches to fluid dynamics, and agent-based modelling in general.
Frequently Asked Questions
What are the rules of Conway’s Game of Life?
A dead cell with exactly three live neighbours becomes alive; a live cell with two or three live neighbours survives; everything else dies or stays dead. Written as B3/S23.
Why does the grid wrap around?
So every cell has exactly eight neighbours and no edge case is needed. The topology is a torus. A bounded grid with dead edges is also valid, but patterns then die when they reach the wall, which changes long-run behaviour.
What is a glider?
A five-cell pattern that reproduces itself one cell diagonally every four generations, so it appears to travel across the grid. It is the smallest and most common spaceship, and gliders serve as signals in Life-based logic circuits.
What is the Gosper glider gun?
A pattern discovered by Bill Gosper in 1970 that emits a glider every 30 generations indefinitely. It was the first known pattern of unbounded growth and won Conway’s $50 prize for settling that question.
Why does my own implementation give wrong results?
Almost always one of two things: updating the grid in place instead of writing to a second buffer, or mishandling the edges so cells near the boundary get the wrong neighbour count. Load the pulsar — if it does not oscillate with period 3, one of those two is the cause.
What is a still life?
A pattern that never changes because every live cell has exactly two or three live neighbours and no dead cell has exactly three. The block, beehive, loaf and boat are the common ones, and a settled random soup is mostly made of them.
Can I change the rule?
Yes — the JavaScript is editable on the page. Change the birth and survival conditions and you get a different automaton: B36/S23 is HighLife, B34/S34 is 34 Life, B2/S is Seeds.
Can I save what I build?
Yes. The playground exports the running demo as a single self-contained HTML file you can open offline or edit further.
Related Tools
The Game of Life is one demo in our JavaScript animation playground, alongside the sorting algorithm visualizer, which animates five sorts implemented as generators, and the Mandelbrot explorer for a different kind of emergent structure from a one-line rule.
Conway’s Game of Life Simulator
A live, editable implementation of Conway’s Game of Life running on a wrapping grid in your browser. Load a starting pattern, set the generation rate, and watch the automaton run — or drag on the canvas to draw your own cells into a running field and see how far the disturbance travels. The JavaScript that produces it is on the page in an editor, so you can change the rule itself and watch a different universe appear.
The Game of Life is not a game and has no players. It is a two-dimensional cellular automaton devised by John Conway in 1970, and it is the standard example of how a rule small enough to write on one line produces behaviour rich enough to be Turing complete.
The Rule: B3/S23
Every cell is alive or dead. Each generation, every cell counts its eight neighbours — orthogonal and diagonal — and applies one rule:
- Birth: a dead cell with exactly 3 live neighbours becomes alive.
- Survival: a live cell with 2 or 3 live neighbours stays alive.
- Death: every other cell is dead next generation — fewer than 2 neighbours is underpopulation, more than 3 is overcrowding.
In code that is a single expression:
next[i] = (n === 3 || (n === 2 && grid[i])) ? 1 : 0;
The shorthand B3/S23 means “born on 3, survives on 2 or 3”. The notation exists because the same machinery runs any rule you care to name: B36/S23 is HighLife, which has a self-replicating pattern; B1/S1 produces fractal replicators; B5678/S45678 is a majority-vote rule that forms blobs. Change two characters in the editor and you are simulating a different universe.
Two implementation details are not optional, and both are common bugs in first attempts:
- The next state must go into a second array, with the two arrays swapped at the end of the pass. Updating in place lets a cell count neighbours that have already advanced to the next generation, which silently produces a different, non-Life automaton.
- The grid wraps — the row above the top row is the bottom row, and the column left of the first is the last. This makes the surface a torus, gives every cell exactly eight neighbours, and removes edge special-casing entirely.
The Starting Patterns
| Pattern | What it is | What to watch |
|---|---|---|
| Random soup | A random field at your chosen density | Most of it dies within about 20 generations; what remains is almost entirely blocks, beehives, blinkers and gliders |
| Gosper glider gun | The first known pattern with unbounded growth | Fires a glider every 30 generations, forever. Slow the rate right down to see the collision on the left that produces each one |
| Pulsar | A period-3 oscillator | The best correctness test there is — an off-by-one in the neighbour count usually kills it within a generation or two |
| R-pentomino | Five cells | Churns chaotically for 1,103 generations before settling. Five cells, a thousand generations of unpredictable behaviour |
| Acorn | Seven cells | 5,206 generations, and it spreads across a far larger area than seems possible |
The vocabulary that emerges from a random soup is worth naming, because it is the same in every run. Still lifes never change: the block (2×2), the beehive, the loaf, the boat. Oscillators repeat with a fixed period: the blinker (three in a row, period 2), the toad (period 2), the pulsar (period 3). Spaceships translate across the grid: the glider moves one cell diagonally every four generations, and the lightweight spaceship moves horizontally. Gliders matter beyond aesthetics — they are the signal wires in Life-based computers, and the gun that emits them is what proved unbounded growth possible, settling Conway’s original open problem.
Controls
- Starting pattern — random soup, Gosper glider gun, pulsar, R-pentomino or acorn.
- Generations per second — 1 to 60. Low values are for watching mechanism; high values are for watching a soup settle.
- Cell size — 2 to 16 pixels. Smaller cells mean a larger grid and more room for patterns to develop before they interfere with themselves across the wrap.
- Soup density — the initial live fraction, 5% to 70%. The interesting regime is around 30%; very high densities die back almost immediately from overcrowding.
- Hue and afterglow — colour, and whether dying cells leave a fading trail that makes the motion of gliders far easier to follow.
- Draw on the canvas — drag to inject live cells into a running simulation.
The simulator is a live JavaScript canvas sandbox: the source is editable on the page, changes run immediately, and you can download the whole thing as a single self-contained HTML file to keep or modify offline.
Why It Matters
Life is Turing complete. Anything a computer can compute can be computed by an initial arrangement of cells — people have built logic gates from glider collisions, memory from oscillators, and a working universal Turing machine, plus a pattern that simulates Life itself. That result is the sharpest available illustration of emergence: the rule contains no notion of a glider, a gun or a computer, yet all of them exist as consequences of it. The same idea underpins reaction-diffusion models of animal markings, lattice-gas approaches to fluid dynamics, and agent-based modelling in general.
Frequently Asked Questions
What are the rules of Conway’s Game of Life?
A dead cell with exactly three live neighbours becomes alive; a live cell with two or three live neighbours survives; everything else dies or stays dead. Written as B3/S23.
Why does the grid wrap around?
So every cell has exactly eight neighbours and no edge case is needed. The topology is a torus. A bounded grid with dead edges is also valid, but patterns then die when they reach the wall, which changes long-run behaviour.
What is a glider?
A five-cell pattern that reproduces itself one cell diagonally every four generations, so it appears to travel across the grid. It is the smallest and most common spaceship, and gliders serve as signals in Life-based logic circuits.
What is the Gosper glider gun?
A pattern discovered by Bill Gosper in 1970 that emits a glider every 30 generations indefinitely. It was the first known pattern of unbounded growth and won Conway’s $50 prize for settling that question.
Why does my own implementation give wrong results?
Almost always one of two things: updating the grid in place instead of writing to a second buffer, or mishandling the edges so cells near the boundary get the wrong neighbour count. Load the pulsar — if it does not oscillate with period 3, one of those two is the cause.
What is a still life?
A pattern that never changes because every live cell has exactly two or three live neighbours and no dead cell has exactly three. The block, beehive, loaf and boat are the common ones, and a settled random soup is mostly made of them.
Can I change the rule?
Yes — the JavaScript is editable on the page. Change the birth and survival conditions and you get a different automaton: B36/S23 is HighLife, B34/S34 is 34 Life, B2/S is Seeds.
Can I save what I build?
Yes. The playground exports the running demo as a single self-contained HTML file you can open offline or edit further.
Related Tools
The Game of Life is one demo in our JavaScript animation playground, alongside the sorting algorithm visualizer, which animates five sorts implemented as generators, and the Mandelbrot explorer for a different kind of emergent structure from a one-line rule.
You build the idea. I'll ship the product.
Productized MVP development for founders. 9 SaaS apps shipped — yours could be next, in 6 weeks. Secure by default.
The rule in one line
Conway's Game of Life runs on B3/S23. A dead cell with exactly three live neighbours is born. A live cell with two or three live neighbours survives. Every other cell dies, from loneliness below two or overcrowding above three.
That is the entire specification. Everything else - gliders, oscillators, guns, and patterns that run for thousands of generations before settling - is a consequence of those two clauses applied to every cell at once.
Patterns worth loading
Gosper glider gun was the first known pattern to grow without bound, producing a new glider every thirty generations. Its discovery in 1970 answered an open question and won a fifty dollar prize.
Pulsar is a period-three oscillator, one of the most common naturally occurring patterns in random soups.
R-pentomino is five cells that take over a thousand generations to stabilise, scattering gliders as it goes. It is the standard illustration that a trivial starting state can have an outcome nobody can work out except by running it.
Acorn is seven cells that run for more than five thousand generations. If you want to see why the Game of Life is described as unpredictable rather than merely complicated, start here and leave it running.
Frequently Asked Questions
Common questions about the Game of Life Simulator
Conway's original B3/S23: a dead cell with exactly three live neighbours is born, and a live cell survives with two or three live neighbours. Everything else dies.
A random soup with adjustable density, the Gosper glider gun, a pulsar, the R-pentomino and the acorn. The last two are famous for producing very long-lived chaotic growth from a handful of cells.
Yes. Drag on the grid to toggle cells while the simulation runs or is paused.
Yes. The edges are joined, so a glider leaving the right side reappears on the left. That keeps long-running patterns from dying at a boundary.
Five cells that take more than a thousand generations to stabilise. It is the standard demonstration that a trivial starting position can have an outcome nobody can predict without simply running it.
No. It is a zero-player cellular automaton: you set the initial state and the rules do the rest. It is Turing complete, which means any computation can in principle be built out of its patterns.
Explore More Tools
Continue with these related tools
ℹ️ Disclaimer
This tool is provided for informational and educational purposes only. All processing happens entirely in your browser - no data is sent to or stored on our servers. While we strive for accuracy, we make no warranties about the completeness or reliability of results. Use at your own discretion.