Skip to content

About

Conway's Game of Life python GUI application.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

83 Commits

Folders and files

Repository files navigation

Conway's Game of Life

A Python GUI application to simulate John Conway's Game of Life.

About

This application provides a full graphical user interface to simulate the famous cellular automaton Game of Life. The rule set was devised by English mathematician John Conway in 1970. The universe of the Game of Life is a two-dimensional matrix of square cells. Traditional simulations allow the matrix to be infinite, but this simulation provides "pac-man connectivity" where the horizontal and vertical edges of the matrix connect back onto itself. Each cell is in either two states, alive or dead. Every cell is connected to it's neighboring eight cells; i.e. the cells horizontally, vertically, and diagonally adjacent. Cells at the edge refer the opposite edge's cells as neighbors. The simulation iterates through generations, where the state of each generation is determined by the rule set:

  • Any alive cell with fewer than two alive neighbours dies, as if by underpopulation.
  • Any alive cell with two or three alive neighbours lives on to the next generation.
  • Any alive cell with more than three alive neighbours dies, as if by overpopulation.
  • Any dead cell with exactly three alive neighbours becomes an alive cell, as if by reproduction.

The application comes with a set of initial patterns to demonstrate different behaviors.

  • The main random pattern creates a randomized initialized pattern that shows the chaotic nature of the Game of Life.
  • Blinker, Toad, Beacon, Pulsar, and Penta Decathlon show oscillator behaviors.
  • Glider shows the potential for spaceships; moving cell patterns that traverse the matrix space.
  • Glider Gun shows the possibility of creating an infinite reproduction of cells (the pac-man connectivity eventually causes the pattern to crash into itself, but a truely infinite matrix would show true infinite reproduction). This pattern of infinite behavior was the first demonstration to disprove Conway's upper limit conjecture. As a result, Game of Life was eventually proved to be Turing Complete.
  • Bunnies demonstrates the potential for emerging behavior, where certain patterns can expand in population rather quickly.

The application was constructed fully in Python. The GUI was constructed with python's native cross-platform tkinter GUI library. Data files are formatted with the TOML configuration file format. The application allows for Windowed and Fullscreen display modes. Further settings can be adjusted in the applications settings menu; specifically the color theme, display characters, and framerate. Default settings are saved in a default.toml file and restored on future launches of the application. This project was created to test python's capabilites of application development with GUI functionality.

Installation

OS X & Linux:

Read 'Known Bugs' section if you intend to use it on OS X or Linux.

Clone the repository and change into it's directory.

git clone https://github.com/hectic4491/gameoflife.git
cd gameoflife

Create and activate a virtual environment.

python3 -m venv venv
source venv/bin/activate

Install dependencies.

pip install -r requirements.txt
sudo apt-get install python3-tk

Run the application.

python3 gameoflife

Windows:

Clone the repository and change into it's directory.

git clone https://github.com/hectic4491/gameoflife.git
cd gameoflife

Create and activate a virtual environment.

python -m venv venv
.\venv\Scipts\activate

Install dependencies.

pip install -r requirements.txt

Run the application.

python gameoflife

Requirements

Python:

  • version: 3.12.26 or higher

Python Libraries:

  • toml
    • version: 0.10.2

Known Bugs

  • In Linux / OS X; the maximize/restore header button does not update the simulation display field. It's recommended to use the setting tab's fullscreen/window button to change the resolution.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Release History

  • 1.0.0 (10/20/2024)
    • Release of Conway's Game of Life application.

Meta

Robert Hunt - ig: @furtiveplant - X: @FurtivePlant - finalrob@gmail.com

https://github.com/hectic4491/gameoflife

About

Conway's Game of Life python GUI application.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages