This is a Python implementation of Conway's Game of Life using the Pygame library. The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input.
To run the Game of Life on your local machine, follow these instructions:
Make sure you have Python 3.x installed on your system.
- Clone the repository to your local machine:
git clone https://github.com/Umang-Lodaya/Conway-Game-of-Life.git
- Navigate to the project directory:
cd Conway-Game-of-Life
- Install the required dependencies using pip:
pip install -r requirements.txt
Run the main Python script to start the Game of Life: python main.py
- Space Bar: Pause/Resume the simulation.
- Left Mouse Button: Draw living cells on the grid.
- Grid Display: Visualizes the grid with living and dead cells.
- Pause/Resume: Allows pausing and resuming the simulation.
- Interactive Drawing: Enables users to draw living cells with the mouse.
You can customize various aspects of the simulation by modifying the following parameters in the main.py script:
- Screen Size: Change the dimensions of the game window by modifying the SCREEN_SIZE constant.
- Cell Size: Adjust the size of individual cells by modifying the CELL_SIZE constant.
- Colors: Modify the colors used for the background, grid, living cells, and next generation cells by changing the corresponding color constants.
- The game grid is represented as a 2D numpy array.
- Pygame library is used for creating the graphical interface.
- Cells follow Conway's rules for birth, survival, and death.
- Cells are updated in each generation based on their neighbors.
Contributions are welcome! Feel free to open issues or pull requests for bug fixes, improvements, or new features.