Implementation of Conway's Game of Life in Rust
The engine implements the standard rules as defined:
- Any live cell with less than two live neighbours dies, underpopulation
- Any live cell with two or three live neighbouds lives on, survival
- Any live cell with more than three live neighbours dies, overpopulation
- Any dead cell with three live neighbouds becomes live, reproduction
An implementation of Conway's Game of Life in rust
USAGE:
gol [FLAGS] [OPTIONS] [file-name]
FLAGS:
-b, --benchmark Runs a benchmark (no rendering, no sleeping)
-h, --help Prints help information
-V, --version Prints version information
-v, --verbose Be verbose
OPTIONS:
-i, --interval <interval> Time (in ms) to sleep between renderings [default: 500]
-t, --iterations <iterations> Number of iterations to run [default: 30]
ARGS:
<file-name> File to seed the universe with
main.rs implements a basic oscillator, as an example.
- Create a new universe:
let mut board = Universe::new(5, 5);
- Initialize the board:
board.bless_cell(3, 1);
board.bless_cell(3, 2);
board.bless_cell(3, 3);
- Iterate
board.tick();
The universe can be seeded from a file, where the dimenstions are obtained from determining the maximum line length for the width, and total line count for height.
Any character position which includes and x
or X
character is
blessed and made live in the initial render. An example seed file for
a pulsar would look as follows:
x x
x x
xx xx
xxx xx xx xxx
x x x x x x
xx xx
xx xx
x x x x x x
xxx xx xx xxx
xx xx
x x
x x