This is a Python implementation of Conway's Game of Life, a cellular automaton devised by mathematician John Conway.
The simulation runs in a graphical window using Pygame, with randomly initialized cells and interactive controls for pausing, clearing, and editing the grid.
Each cell in a 2D grid is either alive or dead. For each generation:
- A live cell with 2 or 3 neighbors survives.
- A dead cell with exactly 3 neighbors becomes alive.
- All other cells die or remain dead.
- Grid size: 60 x 40 cells
- Random initialization
- Toggle simulation with keyboard
- Add live cells with the mouse
- Custom cell colors for dying and living states
| Action | Key / Mouse |
|---|---|
| Pause / Resume | Space |
| Clear grid | Backspace |
| Add live cell | Left-click |
| Quit | Close window |
Install dependencies:
pip install pygame numpy
## ▶️ Run the simulation
```bash
python main.py