This project implements Conway's Game of Life and Langton's Ant.
Both are cellular automaton simulations.
Uses Rich for terminal visualization.
To install make sure you have Python 3.11 or higher (tested with Python 3.13) and uv installed.
-
Clone the repository:
git clone https://github.com/paulrobello/rich_life.git cd rich_life -
Install the required dependencies:
uv sync
To install from PyPI, run any of the following commands:
uv tool install rich-lifepipx install rich-liferich_lifeRun the Game of Life simulation using the following command:
uv run rich_lifeYou 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 mooreRun the Langton's Ant simulation using the following command:
uv run rich_life --mode antsAvailable 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
To run the tests, use the following command:
uv run pytest tests/test_game_of_life.py- 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
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
Paul Robello (probello@gmail.com)


