A simple implementation of Conway's Game of Life using JavaScript and HTML Canvas.
Conway's Game of Life is a cellular automaton with simple rules:
- Any live cell with fewer than two live neighbors dies (underpopulation)
- Any live cell with two or three live neighbors lives on to the next generation
- Any live cell with more than three live neighbors dies (overpopulation)
- Any dead cell with exactly three live neighbors becomes a live cell (reproduction)
- Open
index.html
in your web browser. - Click on the grid to toggle cells between alive and dead.
- Click and drag to draw living cells.
- Use the buttons to control the simulation:
- Start: Begin the simulation
- Stop: Pause the simulation
- Clear: Clear all cells from the grid
- Random: Create a random pattern
- Space: Toggle simulation play/pause
- C: Clear the grid
- R: Generate a random pattern
- G: Add a glider pattern
This is a hand-crafted implementation with features:
- Toroidal grid (edges wrap around)
- Drawing by clicking and dragging
- Keyboard shortcuts
- Adjustable speed
Enjoy watching patterns evolve and creating your own cellular automata!