Skip to main content

CGOL · PyPI GitHub release GitHub repo size GitHub License

A Conway's Game of Life implementation using numpy and pygame.

Description

This project has no particular aim. It is a purely personal project and barely maintained.

It is a CLI based Conway's Game of Life implementation using numpy for fast calculations and pygame for an interactive simulation.

No Hashlife or Quicklife algorithm support (yet).


Rules of Conway's Game of Life

  1. Any live cell with two or three live neighbors survives.
  2. Any dead cell with three live neighbors becomes a live cell.
  3. All other live cells die in the next generation. Similarly, all other dead cells stay dead.

Installing

Install using pip

pip install cgol

Manually install using CLI

git clone https://github.com/INeido/CGOL
pip install -e CGOL/.

Troubleshooting Installation

If you encounter any errors during the installation process, consider the following options:

If pip is not found you can try to access it using

python -m pip

or install it using

python -m ensurepip

You can attempt to install using pipx, a tool designed for running Python applications in isolated environments

pipx install cgol

If issues persist, create a virtual environment and install within it for a clean and isolated setup

python -m venv .venv
source .venv/bin/activate
pip install cgol

Usage

NOTE: If you installed using pipx you might have to run pipx ensurepath once or prepend pipx run to the example commands below.

Here are some examples.

Start a simulation with the default setting but with a custom seed.

cgol -se 42

Change grid size, cell size and fade color.

cgol -cf 130 20 0 -cs 8 -gh 90 -gw 160

Change the color to white on black without fade.

cgol -fa False -ca 255 255 255

Draw with the mouse to birth or kill cells.

Arguments

usage: CGOL [-h] [-rw RW] [-rh RH] [-ca CA [CA ...]] [-cd CD [CD ...]] [-cf CF [CF ...]] [-cb CB [CB ...]] [-cs CS] [-gw GW] [-gh GH] [-ti TI] [-se SE]
            [-ps [PS]] [-po [PO]] [-fr FR] [-fd FD] [-to [TO]] [-fa [FA]]

Conway's Game of Life

options:
  -h, --help       show this help message and exit
  -rw RW           Width of the Game.
  -rh RH           Height of the Game.
  -ca CA [CA ...]  Color for alive cells. 'R G B'
  -cd CD [CD ...]  Color for dead cells. 'R G B'
  -cf CF [CF ...]  Color to fade dead cells to. 'R G B'
  -cb CB [CB ...]  Color for dead cells. 'R G B'
  -cs CS           Size of a cell in pixel.
  -gw GW           Width of the World.
  -gh GH           Height of the World.
  -ti TI           Number of times the game shall update in a second (FPS).
  -se SE           Seed value used to create World.
  -ps [PS]         Game pauses on a stalemate.
  -po [PO]         Game pauses when only oscillators remain.
  -fr FR           Value by which a cell should decrease every generation.
  -fd FD           Value a cell should have after death.
  -to [TO]         Enables toroidal space (Cells wrap around edges).
  -fa [FA]         Enables fade effect.
Argument Description Default Value
-rh Height of the Game. 720
-rw Width of the Game. 1280
-ca Colour for alive cells. 'R G B' 255, 144, 0
-cd Colour for dead cells. 'R G B' 0, 0, 0
-cf Colour to fade dead cells to. 'R G B' 0, 0, 0
-cb Colour of background. 'R G B' 16, 16, 16
-cs Size of a cell in pixel 8
-sx Height of the World. 90
-sy Width of the World. 160
-ti Number of times the game shall update in a second (FPS). 60
-se Seed value used to create World. -1
-ps Game pauses on a stalemate. False
-po Game pauses when only oscillators remain. False
-fr Value by which a cell should decrease every generation. 0.01
-fd Value a cell should have after death. 0.5
-to Enables toroidal space (Cells wrap around edges). True
-fa Enables fade effect. True

Controls

Button Description
ESC Closes game.
RETURN Pauses game.
Left Click Births cell.
Right Click Kills cell.
Middle Click Drags screen.
Middle Scroll Zoom in and out.
R Reset game.
F Fill with random cells.
A Fill with alive cells.
D Fill with dead cells.
K Kill alive cells.
R Reset game.
L Load last saved game.
S Save current game.
C Center view.
P Save screenshot.
I Toggle Insert Mode.
Left Click (Insert Mode) Place loaded pattern.
Middle Scroll (Insert Mode) Rotate loaded pattern.
1 Load 1.rle.
2 Load 2.rle.
3 Load 3.rle.
Right Arrow Forward one generation.
+ Extend grid by one cell in every direction.
- Reduce grid by one cell in every direction.

Metadata

Release files for CGOL 0.9.6

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

Source distribution (sdist)

Source distribution for CGOL 0.9.6
File Size Uploaded Provenance Actions
CGOL-0.9.6.tar.gz 29.0 kB Without provenance Details for CGOL-0.9.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for CGOL 0.9.6
File Interpreter ABI Platform Actions
CGOL-0.9.6-py3-none-any.whl Python 3 none any Details for CGOL-0.9.6-py3-none-any.whl

Total release size: 59.3 kB

Release files / CGOL-0.9.6.tar.gz

Download URL CGOL-0.9.6.tar.gz
Size 29.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c6a89dfe36b2b7cd8d1d957b6cad0379fbcc7cdd82a66ba320d72a7d73b6c9ea
BLAKE2b-256 checksum
How to use checksums
c91711d3caf3260cca85014615c92a0b80f6959c1c3748f22a12126691702b32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / CGOL-0.9.6-py3-none-any.whl

Download URL CGOL-0.9.6-py3-none-any.whl
Size 30.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab04471691c11bef0d36537117951f02c213330b5480a94d5750751777d6b77e
BLAKE2b-256 checksum
How to use checksums
127ad0207a0f5df9944ba32eab842c6b769a06c27a49917215de3d3c8a0a78e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Security for CGOL 0.9.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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