Skip to content

Conway's Game of Life created with Pygame. Learning project to get more comfortable with Python's OOP and inheritance.

License

Notifications You must be signed in to change notification settings

EloiSanchez/game-of-life

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Game of Life

Conway's Game of Life implementation in Python using Pygame.

This project was started as a learning experience to get better with OOP and object inheritance in Python. It is noticeable that some parts of the code are cleaner than others, since I obviously learned a lot during the weeks that I dedicated to code this.

It was also the first time I used Pygame. Therefore, I am sure that there are good practices that I did not follow and better ways to implement what I did. Nevertheless, there are some conscious choices, such as coding the menu buttons from scratch, that I made because I truly wanted to implement them from scratch as a learning and practice experience.

Game of life Screenshot

You can also download or watch a video in Youtube of the current state of the game as of 31/05/2023.

Features

Since this was a side project and I could not dedicate lots of time, I decided to limit the scope of what I wanted to implement.

  • Regular grid of cells that the user can click on to change state
  • Working Game of Life that can propagate over time without Periodic Boundary Conditions
  • Some way for the user to start and stop the simulation

Optionals

  • Periodic Boundary Conditions
  • Some kind of UI menu for the user to click on
  • Clear and randomize states
  • Save and load states, including some predefined ones
  • Camera that can move through the grid instead of having a fixed screen
  • Slider that can change simulation speed

How to use

I also decided to take the time to learn Poetry for environment management, which automatically creates a '.toml' file that can be used to install the dependencies.

Clone the repository at the desired location

git clone https://github.com/EloiSanchez/game-of-life

and go into the newly created directory

cd game-of-life

Poetry

If using Poetry, create and activate the environment with

poetry install
poetry shell

and then run the game with

python game_of_life/game_of_life.py

or Windows/Mac or whatever equivalent.

Others

If using any other environment manager, create a new environment and activate it. Then, run

pip install .

and then run the game with

python game_of_life/game_of_life.py

or Windows/Mac equivalent.

About me

At the time of writing this I am working as an Analytics Engineer mainly with Snowflake and dbt. Nevertheless, I still love to code more general stuff such as this game to keep on improving my general coding skills.

If you have any question, problem, suggestion or fix, please, create an issue or contact me directly.

Eloi Sanchez Ambros

About

Conway's Game of Life created with Pygame. Learning project to get more comfortable with Python's OOP and inheritance.

Topics

Resources

License

Stars

Watchers

Forks

Languages