Skip to main content

Conway's Game of Life in Python

This project is a Python implementation of Conway's Game of Life, a cellular automaton devised by the British mathematician John Horton Conway in 1970. The game is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. One interacts with the Game of Life by creating an initial configuration and observing how it evolves.

Introduction

The Game of Life is not your typical computer game. It consists of a grid of cells which, based on a few mathematical rules, can live, die or multiply. Depending on the initial conditions, the cells form various patterns throughout the course of the game.

The packages is available on PyPI: https://pypi.org/project/game-of-life-YETIYETYET/

Rules of the Game

The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, alive or dead. Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:

  1. Underpopulation: A live cell with fewer than two live neighbours dies.
  2. Stasis: A live cell with two or three live neighbours lives on to the next generation.
  3. Overpopulation: A live cell with more than three live neighbours dies.
  4. Reproduction: A dead cell with exactly three live neighbours becomes a live cell.

The initial pattern constitutes the seed of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed, live or dead; births and deaths occur simultaneously.

Sample of the output project

Demo GameOfLife

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Before running this project, you need to have Python installed on your system (Python 3.12 is recommended). You can download Python from the official website: https://www.python.org/downloads/

Installing

Clone the repository to your local machine: git clone https://github.com/YetiYetYet/game-of-life-python.git

Install the required dependencies : pip install -r requirements.txt

Running the Game

To run the game, execute the following command in the terminal: python main.py

Usage

  1. Run the main script.
  2. Follow the instructions in the terminal. It will ask to enter a size for the grid, a starting alive probability. By default, if you enter nothing, the size will be 10x40 and the starting alive probability will be 0.5.
  3. Watch the game evolve in your terminal.

Authors

Questions/Contact

If you have any questions or concerns, please reach out to me at alexisbehier22@gmail.com.

Metadata

Release files for game-of-life-YetiYetYet 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for game-of-life-YetiYetYet 0.1.0
File Size Uploaded
game_of_life_YetiYetYet-0.1.0.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for game-of-life-YetiYetYet 0.1.0
File Interpreter ABI Platform
game_of_life_YetiYetYet-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 kB

Release files / game_of_life_YetiYetYet-0.1.0.tar.gz

Download URL game_of_life_YetiYetYet-0.1.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2be4008214d8c14cf1a12ebb3f9a5e56a6a5688f4e9ea3d8b42a88b02dd004a4
BLAKE2b-256 checksum
How to use checksums
dec951ef24ff0d7665f09880c5e1754135e67cfbf706244e6a04eae1ed04291e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / game_of_life_YetiYetYet-0.1.0-py3-none-any.whl

Download URL game_of_life_YetiYetYet-0.1.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9125a82c83dd6a6e458168e499ccf40b9fb0f874a1c2c5121bb32fbc54a619a
BLAKE2b-256 checksum
How to use checksums
87e124626a06e034f8df6f56405219e3c13e3db2da1786b65dcf00815c1c746d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.9

2 release files

0.0.8

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page