CGOL


NameCGOL JSON
Version 0.9.6 PyPI version JSON
download
home_page
SummaryA whack Conway's Game of Life implementation.
upload_time2023-10-30 16:40:13
maintainer
docs_urlNone
author
requires_python>=3
licenseGPL-3
keywords
VCS
bugtrack_url
requirements argparse pygame numpy setuptools
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CGOL · [![PyPI](https://img.shields.io/pypi/v/CGOL?style=for-the-badge&logo=PyPi)](https://pypi.org/project/CGOL/) [![GitHub release](https://img.shields.io/github/v/release/INeido/CGOL?label=GitHub&style=for-the-badge&logo=GitHub)](https://github.com/INeido/CGOL/releases) ![GitHub repo size](https://img.shields.io/github/repo-size/INeido/CGOL?style=for-the-badge) ![GitHub License](https://img.shields.io/github/license/INeido/CGOL?style=for-the-badge)

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

![](https://github.com/INeido/CGOL/blob/main/samples/logo.png?raw=true)

## 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](https://en.wikipedia.org/wiki/Conway%27s_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
```bash
pip install cgol
```

Manually install using CLI
```bash
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 
```bash
python -m pip
```
or install it using
```bash
python -m ensurepip
```

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

If issues persist, create a virtual environment and install within it for a clean and isolated setup
```bash
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.
```bash
cgol -se 42
```
![](https://github.com/INeido/CGOL/blob/main/samples/demo1.gif?raw=true)

Change grid size, cell size and fade color.
```bash
cgol -cf 130 20 0 -cs 8 -gh 90 -gw 160
```
![](https://github.com/INeido/CGOL/blob/main/samples/demo2.gif?raw=true)

Change the color to white on black without fade.
```bash
cgol -fa False -ca 255 255 255
```
![](https://github.com/INeido/CGOL/blob/main/samples/demo3.gif?raw=true)

Draw with the mouse to birth or kill cells.

![](https://github.com/INeido/CGOL/blob/main/samples/demo0.gif?raw=true)


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

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "CGOL",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": "Neido <reg@neido.de>",
    "keywords": "",
    "author": "",
    "author_email": "Neido <reg@neido.de>",
    "download_url": "https://files.pythonhosted.org/packages/c9/17/11d3caf3260cca85014615c92a0b80f6959c1c3748f22a12126691702b32/CGOL-0.9.6.tar.gz",
    "platform": null,
    "description": "# CGOL &middot; [![PyPI](https://img.shields.io/pypi/v/CGOL?style=for-the-badge&logo=PyPi)](https://pypi.org/project/CGOL/) [![GitHub release](https://img.shields.io/github/v/release/INeido/CGOL?label=GitHub&style=for-the-badge&logo=GitHub)](https://github.com/INeido/CGOL/releases) ![GitHub repo size](https://img.shields.io/github/repo-size/INeido/CGOL?style=for-the-badge) ![GitHub License](https://img.shields.io/github/license/INeido/CGOL?style=for-the-badge)\n\nA Conway's Game of Life implementation using numpy and pygame.\n\n![](https://github.com/INeido/CGOL/blob/main/samples/logo.png?raw=true)\n\n## Description\n\nThis project has no particular aim. It is a purely personal project and barely maintained.\n\nIt is a CLI based [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) implementation using numpy for fast calculations and pygame for an interactive simulation.\n\nNo Hashlife or Quicklife algorithm support (yet).\n\n---\n\nRules of Conway's Game of Life\n1. Any live cell with two or three live neighbors survives.\n2. Any dead cell with three live neighbors becomes a live cell.\n3. All other live cells die in the next generation. Similarly, all other dead cells stay dead.\n\n## Installing\n\nInstall using pip\n```bash\npip install cgol\n```\n\nManually install using CLI\n```bash\ngit clone https://github.com/INeido/CGOL\npip install -e CGOL/.\n```\n\n### Troubleshooting Installation\n\nIf you encounter any errors during the installation process, consider the following options:\n\nIf pip is not found you can try to access it using \n```bash\npython -m pip\n```\nor install it using\n```bash\npython -m ensurepip\n```\n\nYou can attempt to install using pipx, a tool designed for running Python applications in isolated environments\n```bash\npipx install cgol\n```\n\nIf issues persist, create a virtual environment and install within it for a clean and isolated setup\n```bash\npython -m venv .venv\nsource .venv/bin/activate\npip install cgol\n```\n\n## Usage\n\nNOTE: If you installed using pipx you might have to run `pipx ensurepath` once or prepend `pipx run` to the example commands below.\n\nHere are some examples.\n\nStart a simulation with the default setting but with a custom seed.\n```bash\ncgol -se 42\n```\n![](https://github.com/INeido/CGOL/blob/main/samples/demo1.gif?raw=true)\n\nChange grid size, cell size and fade color.\n```bash\ncgol -cf 130 20 0 -cs 8 -gh 90 -gw 160\n```\n![](https://github.com/INeido/CGOL/blob/main/samples/demo2.gif?raw=true)\n\nChange the color to white on black without fade.\n```bash\ncgol -fa False -ca 255 255 255\n```\n![](https://github.com/INeido/CGOL/blob/main/samples/demo3.gif?raw=true)\n\nDraw with the mouse to birth or kill cells.\n\n![](https://github.com/INeido/CGOL/blob/main/samples/demo0.gif?raw=true)\n\n\n## Arguments\n\n```\nusage: 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]\n            [-ps [PS]] [-po [PO]] [-fr FR] [-fd FD] [-to [TO]] [-fa [FA]]\n\nConway's Game of Life\n\noptions:\n  -h, --help       show this help message and exit\n  -rw RW           Width of the Game.\n  -rh RH           Height of the Game.\n  -ca CA [CA ...]  Color for alive cells. 'R G B'\n  -cd CD [CD ...]  Color for dead cells. 'R G B'\n  -cf CF [CF ...]  Color to fade dead cells to. 'R G B'\n  -cb CB [CB ...]  Color for dead cells. 'R G B'\n  -cs CS           Size of a cell in pixel.\n  -gw GW           Width of the World.\n  -gh GH           Height of the World.\n  -ti TI           Number of times the game shall update in a second (FPS).\n  -se SE           Seed value used to create World.\n  -ps [PS]         Game pauses on a stalemate.\n  -po [PO]         Game pauses when only oscillators remain.\n  -fr FR           Value by which a cell should decrease every generation.\n  -fd FD           Value a cell should have after death.\n  -to [TO]         Enables toroidal space (Cells wrap around edges).\n  -fa [FA]         Enables fade effect.\n```\n\n| Argument | Description | Default Value |\n| ------ | ------ | ------ |\n| -rh | Height of the Game. | 720 |\n| -rw | Width of the Game. | 1280 |\n| -ca | Colour for alive cells. 'R G B' | 255, 144, 0 |\n| -cd | Colour for dead cells. 'R G B' | 0, 0, 0 |\n| -cf | Colour to fade dead cells to. 'R G B' | 0, 0, 0 |\n| -cb | Colour of background. 'R G B' | 16, 16, 16 |\n| -cs | Size of a cell in pixel | 8 |\n| -sx | Height of the World. | 90 |\n| -sy | Width of the World. | 160 |\n| -ti | Number of times the game shall update in a second (FPS). | 60 |\n| -se | Seed value used to create World. | -1 |\n| -ps | Game pauses on a stalemate. | False |\n| -po | Game pauses when only oscillators remain. | False |\n| -fr | Value by which a cell should decrease every generation. | 0.01 |\n| -fd | Value a cell should have after death. | 0.5 |\n| -to | Enables toroidal space (Cells wrap around edges). | True |\n| -fa | Enables fade effect. | True |\n\n## Controls\n\n| Button | Description |\n| ------ | ------ |\n| ESC | Closes game. |\n| RETURN | Pauses game. |\n| Left Click | Births cell. |\n| Right Click | Kills cell. |\n| Middle Click | Drags screen. |\n| Middle Scroll | Zoom in and out. |\n| R | Reset game. |\n| F | Fill with random cells. |\n| A | Fill with alive cells. |\n| D | Fill with dead cells. |\n| K | Kill alive cells. |\n| R | Reset game. |\n| L | Load last saved game. |\n| S | Save current game. |\n| C | Center view. |\n| P | Save screenshot. |\n| I | Toggle Insert Mode. |\n| Left Click | (Insert Mode) Place loaded pattern. |\n| Middle Scroll | (Insert Mode) Rotate loaded pattern. |\n| 1 | Load `1.rle`. |\n| 2 | Load `2.rle`. |\n| 3 | Load `3.rle`. |\n| Right Arrow | Forward one generation. |\n| + | Extend grid by one cell in every direction. |\n| - | Reduce grid by one cell in every direction. |\n",
    "bugtrack_url": null,
    "license": "GPL-3",
    "summary": "A whack Conway's Game of Life implementation.",
    "version": "0.9.6",
    "project_urls": {
        "Homepage": "https://github.com/INeido/CGOL/",
        "Issues": "https://github.com/INeido/CGOL/issues",
        "Repository": "https://github.com/INeido/CGOL/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "127ad0207a0f5df9944ba32eab842c6b769a06c27a49917215de3d3c8a0a78e9",
                "md5": "d800dac3f072e5d28fb2f343320318b3",
                "sha256": "ab04471691c11bef0d36537117951f02c213330b5480a94d5750751777d6b77e"
            },
            "downloads": -1,
            "filename": "CGOL-0.9.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d800dac3f072e5d28fb2f343320318b3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3",
            "size": 30300,
            "upload_time": "2023-10-30T16:40:11",
            "upload_time_iso_8601": "2023-10-30T16:40:11.926410Z",
            "url": "https://files.pythonhosted.org/packages/12/7a/d0207a0f5df9944ba32eab842c6b769a06c27a49917215de3d3c8a0a78e9/CGOL-0.9.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c91711d3caf3260cca85014615c92a0b80f6959c1c3748f22a12126691702b32",
                "md5": "8fa305b3015d4a3591fe73d3aac7f8e2",
                "sha256": "c6a89dfe36b2b7cd8d1d957b6cad0379fbcc7cdd82a66ba320d72a7d73b6c9ea"
            },
            "downloads": -1,
            "filename": "CGOL-0.9.6.tar.gz",
            "has_sig": false,
            "md5_digest": "8fa305b3015d4a3591fe73d3aac7f8e2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 29038,
            "upload_time": "2023-10-30T16:40:13",
            "upload_time_iso_8601": "2023-10-30T16:40:13.888314Z",
            "url": "https://files.pythonhosted.org/packages/c9/17/11d3caf3260cca85014615c92a0b80f6959c1c3748f22a12126691702b32/CGOL-0.9.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-30 16:40:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "INeido",
    "github_project": "CGOL",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "argparse",
            "specs": []
        },
        {
            "name": "pygame",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "setuptools",
            "specs": []
        }
    ],
    "lcname": "cgol"
}
        
Elapsed time: 0.23262s