Skip to main content

A whack Conway's Game of Life implementation.

Project description

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 a 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.


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/.

Usage

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 -fd 0.0 -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]
            [-sf SF] [-lo LO] [-ps PS] [-po PO] [-fr FR] [-fd FD]

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.
  -sf SF           Path of the in-/output file. (Should be .csv)
  -lo LO           Load revious save.
  -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.
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
-sf Path of the in-/output file. (Should be .csv) '~/cgol.csv'
-lo Load revious save. False
-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

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.
Right Arrow Forward one generation.
+ Extend grid by one cell in every direction.
- Reduce grid by one cell in every direction.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

CGOL-0.9.1.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

CGOL-0.9.1-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file CGOL-0.9.1.tar.gz.

File metadata

  • Download URL: CGOL-0.9.1.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.7

File hashes

Hashes for CGOL-0.9.1.tar.gz
Algorithm Hash digest
SHA256 a959c9dd5a2a6eaf3d10f850feb14c66e7b37113dfeb52edf4c4e9fdfacf05ea
MD5 079608ff69ab63927aae2299785a7f3b
BLAKE2b-256 2af3335690fb60d679650fc588d549a7883424be1693d984f88a8225ebdb9ac1

See more details on using hashes here.

File details

Details for the file CGOL-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: CGOL-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 24.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.7

File hashes

Hashes for CGOL-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 abd9dd5be6ebd4f7cb4e8cf2b2813cccfd7e74d44c8cb93f896af90fa5a7f1fe
MD5 4cc3844d96da18661bae7e67256c327f
BLAKE2b-256 5be535ef1bdae7612f0c6e8ea84931aa33becd7c6cb075fc65d8dbaa63123372

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page