Python >=3.10 implementation of Conway's Game of Life using PyQt6
Clone the project
git clone https://github.com/bartosz121/game-of-life-python
Go to the project directory
cd game-of-life-python
Create new virtual environment
python -m venv env
Activate environment
# on Linux
source env/bin/activate
# on Windows
./env/Scripts/activate
Install dependencies
pip install -r requirements.txt
Play!
python game_of_life/run.py
- Start game with random alive cells
- Map editor (example of creating a Glider)
- Load pattern from file in
.cells
or.rle
format (Dragon) you can download a pack of patterns from here
- Rotate loaded pattern (Copperhead)
- Save pattern to a file (
.cells
or.rle
format)
-
Press
ESC
to go back or pause while playing -
While playing press
M
to enterMap Editor
-
Left Mouse Button
makes clicked cell aliveRight Mouse Button
makes clicked cell dead- Press
M
to exit map editor and start the game - When saving a pattern to a file press
Left Mouse Button
once to select starting point, then pressLeft Mouse Button
again to choose the end - After pattern from a file is loaded press:
Left Mouse Button
to place it in the gridRight Mouse Button
to transpose itMiddle Mouse Button
to transpose it over the other diagonal
You can change window size and interval timer in run.py
file;
game = GameOfLife(800, 600, timer_interval=120)
All other settings (like cell width/height/color) can be changed in settings.py
file, inside Settings
class
- Implement other game of life algorithms (hashlife)
- Keep settings in JSON file instead of .py
- Better error handling
- Copy-Paste feature
- Change color of the rectangle for each direction when rotating loaded pattern
- Better GUI
- Display game data (alive cells, generation)
- Better performance with large resolution