Skip to main content

Conway's Game of Life and Langton's Ant

PyPI PyPI - Python Version
Runs on Linux | MacOS | Windows Arch x86-63 | ARM | AppleSilicon
PyPI - License

About

This project implements Conway's Game of Life and Langton's Ant.
Both are cellular automaton simulations. Uses Rich for terminal visualization.

"Buy Me A Coffee"

Screenshots

Game of Life Screenshot Langton's Ant Screenshot

Installation

To install make sure you have Python 3.11 or higher (tested with Python 3.13) and uv installed.

Installation From Source

  1. Clone the repository:

    git clone https://github.com/paulrobello/rich_life.git
    cd rich_life
    
  2. 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:

  • --width or -w: Width of the grid (default: half of console height)
  • --height or -h: Height of the grid (default: half of console height minus 2)
  • --infinite or -i: Enable infinite mode. Simulation grid has no bounds (default: False)
  • --generations or -g: Number of generations to simulate (default: 100)
  • --mode or -m: Simulation mode (options: 'life' or 'ants', default: 'ants')
  • --rules or -r: Neighborhood rules for game of life (options: 'moore' or 'van_neumann', default: 'moore')
  • --offset-x or -x: Bord display X-coordinate offset for infinite mode (default: 0)
  • --offset-y or -y: Bord display Y-coordinate offset for infinite mode (default: 0)
  • --rps or -r: Refresh / generations per second (default: 10)
  • --follow or -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)

Metadata

Release files for rich-life 0.3.1

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

Source distribution (sdist)

Source distribution for rich-life 0.3.1
File Size Uploaded
rich_life-0.3.1.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rich-life 0.3.1
File Interpreter ABI Platform
rich_life-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.7 kB

Release files / rich_life-0.3.1.tar.gz

Download URL rich_life-0.3.1.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
762d9d779950eb9b5f52af4ac9c8f42136992ad8fdd839c2a27370675353cffd
BLAKE2b-256 checksum
How to use checksums
de914aa07997e2a20cb4b265403cf72ccbe6ed63469c7dc70ed0e88f702ed919
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2025.

Transparency log

Release files / rich_life-0.3.1-py3-none-any.whl

Download URL rich_life-0.3.1-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a9aa43cd8991bf1ec0b04654d87bbb1f3c4ed008999ec7cb0a71be98a4b892d
BLAKE2b-256 checksum
How to use checksums
05c886690951ef28c4114ef2dd847d456b35843a17e66fcf77f4aef3768dc2f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

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