cars is a CLI + TUI tool for simulating custom, rule-based cellular automata. It supports multiple presets, custom rule input, and real-time visualizations using Ratatui.
- Simulate 2D binary-state cellular automata (e.g., Conway’s Game of Life)
- Custom rules in
B/Snotation (e.g.,B3/S23) - ASCII or interactive TUI rendering with Ratatui
- Built-in presets:
glider,blinker,block - CLI-based configuration of rules, grid size, steps, and more
cargo build --releasecargo runcargo run -- --preset glider --width 40 --height 20 --ui tuicargo run -- --preset glider --rule B36/S23 --ui tuicargo run -- --preset blinker --width 30 --height 30 --ui tui| Flag | Description | Default |
|---|---|---|
--rule |
Cellular automaton rule string in B/S format |
B3/S23 |
--width |
Grid width | 10 |
--height |
Grid height | 10 |
--steps |
Number of generations to simulate (omit to run until Ctrl+C) | (infinite) |
--preset |
Pattern to seed initially (glider, blinker, block) |
(optional) |
--ui |
UI mode: tui for interactive, omit for plain terminal output |
(optional) |
Uses standard Life-like cellular automaton notation:
B= birth conditionsS= survival conditions
Example:
B3/S23 (Conway’s Game of Life):
- Dead cells become alive with exactly 3 neighbors
- Live cells survive with 2 or 3 neighbors
- Export simulation frames to GIF
- Support for random seeding
- Interactive controls: pause/resume, speed adjustment
- Support for non-totalistic and multi-state automata
MIT