You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
This is a simple implementation of Conway's Game of Life using the pygame library in Python.
Description
Conway's Game of Life is a cellular automaton devised by mathematician John Conway. It is a zero-player game, meaning its evolution is determined by its initial state, with no further input required. The game consists of a grid of cells, each of which can be either alive or dead. The game evolves in steps based on a set of rules:
Any live cell with fewer than two live neighbors dies (underpopulation).
Any live cell with two or three live neighbors survives.
Any live cell with more than three live neighbors dies (overpopulation).
Any dead cell with exactly three live neighbors becomes a live cell (reproduction).
Features
Click on cells to toggle their state between alive and dead.
Press the spacebar to start or pause the simulation.
Pressc to clear the grid and reset it to a random initial state.
Pressg to generate a random pattern of living cells on the grid.
Install the required dependencies (Pygame):pip install pygame
Run the simulation:python life-of-cells.py
Controls
Left Mouse Button: Toggle the state of individual cells (alive/dead).
Spacebar: Start or pause the simulation.
c Key: Clear the grid and reset it to a random initial state.
g Key: Generate a random pattern of living cells on the grid.
Credits
The Game of Life rules were devised by John Conway.
Special thanks to TechwithTim for their tutorial on John Conway's Game of Life using Python and Pygame, which served as an inspiration for this project.
About
A colorful twist on Conway's Game of Life, with changing colors for each new cell.