Game of Life

Build Status codecov

Little project which implements Conway's Game of Life.

The API doc of the whole crate is here.

Build and Run

To buid the game you need Rust and Cargo installed. Then type:

cargo clean
cargo test
cargo build --release

Then you can invoke the game with:

./target/release/game_of_life -h

To see the available options or without -h to run it with defaults.

The Rules

There are four simple rules when a living cell dies or a new cell will be born:

  • C living cell
  • N neighbour cell
  • x died cell

1. Rule

A cell dies if it has < 2 neighbours:

C -> x

or

CN -> xN

2. Rule

A cell survives if it has exactly 2 or 3 neighbours:

CN -> CN
N     N

or

NCN -> NCN
 N      N

3. Rule

A cell dies if it has > 3 neighbours:

 N      N
NCN -> NxN
 N      N

or

NNN    NNN
NCN -> NxN
NNN    NNN

4. Rule

A new cell is born at an empty place, if this place has exactly 3 neighbours:

C   -> CC
 CC     CC