A Conway’s Game of Life simulation written in Rust, using the minifb crate for windowed rendering. This project showcases how to build a simple cellular automaton with live controls (restart, speed up/down) in a native desktop window.
- Random initial state on startup and on restart
- Tick‑based evolution following Conway’s rules
- Real‑time controls
- Rust toolchain (with
cargo): Install via rustup.rs - Git (optional, for cloning)
- Platform: Windows, macOS, or Linux
git clone https://github.com/josueggh/rust-game-of-life.git
cd rust-game-of-lifeThe only external dependencies are in Cargo.toml:
minifbfor windolet width = 128; // grid width let height = 128; // grid height let scale = 4; // pixel size of each cell let mut delay = 50; // milliseconds between framesw management and pixel bufferrandfor random initialization
Cargo will fetch these automatically.
In the project root:
cargo run --releaseBy default, the simulation runs at 128×128 cells with a 4×4 pixel scale and 50 ms delay between ticks.
Adjust these settings in src/main.rs if desired.
In src/main.rs, you can modify:
let width = 128; // grid width
let height = 128; // grid height
let scale = 4; // pixel size of each cell
let mut delay = 50; // milliseconds between framesTweak these constants, then rebuild with cargo run --release.
| Key | Action |
|---|---|
| R | Restart with a new random universe |
| ↑ | Speed up (decrease delay by 5 ms) |
| ↓ | Slow down (increase delay by 5 ms) |
| Esc | Exit application |
This project is licensed under the MIT License. See LICENSE for details.