Terminal-based life and ant simulation.
Project description
Conway's Game of Life and Langton's Ant
About
This project implements Conway's Game of Life and Langton's Ant.
Both are cellular automaton simulations.
Uses Rich for terminal visualization.
Screenshots
Installation
To install make sure you have Python 3.11 or higher (tested with Python 3.13) and uv installed.
Installation From Source
-
Clone the repository:
git clone https://github.com/paulrobello/rich_life.git cd rich_life
-
Install the required dependencies:
uv sync
Installation From PyPI
To install from PyPI, run any of the following commands:
uv tool install rich-life
pipx install rich-life
Usage
Running if installed from PyPI
rich_life
Running from source
Run the Game of Life simulation using the following command:
uv run rich_life
You can customize the grid size, number of generations, and neighborhood rules using command-line options:
uv run rich_life --width 50 --height 30 --generations 300 --rules moore
Run the Langton's Ant simulation using the following command:
uv run rich_life --mode ants
Available options:
--widthor-w: Width of the grid (default: half of console height)--heightor-h: Height of the grid (default: half of console height minus 2)--infiniteor-i: Enable infinite mode. Simulation grid has no bounds (default: False)--generationsor-g: Number of generations to simulate (default: 100)--modeor-m: Simulation mode (options: 'life' or 'ants', default: 'ants')--rulesor-r: Neighborhood rules for game of life (options: 'moore' or 'van_neumann', default: 'moore')--offset-xor-x: Bord display X-coordinate offset for infinite mode (default: 0)--offset-yor-y: Bord display Y-coordinate offset for infinite mode (default: 0)--rpsor-r: Refresh / generations per second (default: 10)--followor-f: Follow the ant in ANTS mode (default: False)
Keys:
- 'Arrows' / 'WSAD': Pan the grid
Running Tests
To run the tests, use the following command:
uv run pytest tests/test_game_of_life.py
What's New
- Version 0.3.1: Updated dependencies and ensured compatibility with Python 3.13
- Version 0.3.0: Added follow mode for Langton's Ant
- Version 0.2.0: Better keyboard handling
- Version 0.1.0: Initial release
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is open source and available under the MIT License.
Author
Paul Robello (probello@gmail.com)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rich_life-0.3.1.tar.gz.
File metadata
- Download URL: rich_life-0.3.1.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
762d9d779950eb9b5f52af4ac9c8f42136992ad8fdd839c2a27370675353cffd
|
|
| MD5 |
2132078ec0aa59583d6a4cf2a75ce924
|
|
| BLAKE2b-256 |
de914aa07997e2a20cb4b265403cf72ccbe6ed63469c7dc70ed0e88f702ed919
|
Provenance
The following attestation bundles were made for rich_life-0.3.1.tar.gz:
Publisher:
publish.yml on paulrobello/rich_life
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rich_life-0.3.1.tar.gz -
Subject digest:
762d9d779950eb9b5f52af4ac9c8f42136992ad8fdd839c2a27370675353cffd - Sigstore transparency entry: 639271078
- Sigstore integration time:
-
Permalink:
paulrobello/rich_life@edac2fa71fcd2770e40341116774ed538e5e80c7 -
Branch / Tag:
refs/tags/release-v0.3.1 - Owner: https://github.com/paulrobello
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@edac2fa71fcd2770e40341116774ed538e5e80c7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rich_life-0.3.1-py3-none-any.whl.
File metadata
- Download URL: rich_life-0.3.1-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a9aa43cd8991bf1ec0b04654d87bbb1f3c4ed008999ec7cb0a71be98a4b892d
|
|
| MD5 |
058e4bb057564381a48fda301b3d00c9
|
|
| BLAKE2b-256 |
05c886690951ef28c4114ef2dd847d456b35843a17e66fcf77f4aef3768dc2f6
|
Provenance
The following attestation bundles were made for rich_life-0.3.1-py3-none-any.whl:
Publisher:
publish.yml on paulrobello/rich_life
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rich_life-0.3.1-py3-none-any.whl -
Subject digest:
5a9aa43cd8991bf1ec0b04654d87bbb1f3c4ed008999ec7cb0a71be98a4b892d - Sigstore transparency entry: 639271087
- Sigstore integration time:
-
Permalink:
paulrobello/rich_life@edac2fa71fcd2770e40341116774ed538e5e80c7 -
Branch / Tag:
refs/tags/release-v0.3.1 - Owner: https://github.com/paulrobello
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@edac2fa71fcd2770e40341116774ed538e5e80c7 -
Trigger Event:
push
-
Statement type: