Skip to content

splo/life

Repository files navigation

Life

A simple Game of Life written in Rust.

Web UI Screenshot

Features

  • Continuously update the grid of cells.
  • Beautifully display grids in the console!
  • Serve a web page that displays the current grid in HTML.
  • Start with a new randomized grid.
  • Customize starting grid width, height and amount of living cells.
  • Customize grid update frequency.

Usage

  • Download & unzip the latest release.
  • Then just run the single binary file:
./bin/life

Example output:

Server running at http://localhost:8090/
/--------------------\
|   o   o            |
|oo     o  o   o  o o|
| o o o oooo ooo  oo |
| o       o     o    |
|oo  o   o  o    oo  |
|  oo   oo       oooo|
| o oo      o o    o |
| o o  o o o  o o   o|
|o          oo   o   |
|    o oo o o ooo    |
\--------------------/
  • Press Ctrl-C to stop the game.

You can specify the following options:

USAGE:
    life [OPTIONS]

FLAGS:
        --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -a, --alive <alive-ratio>             Starting grid ratio of alive cells, between 0 and 1 [default: 0.3]
    -h, --height <grid-height>            Starting grid height, at least 3 [default: 10]
    -w, --width <grid-width>              Starting grid width, at least 3 [default: 20]
    -p, --port <port>                     Web server port to listen to [default: 8090]
    -f, --frequency <update-frequency>    Cell generation update frequency in Hz [default: 1.0]

Development

Requirements

Building, Testing and Running

Just run standard cargo commands.

# Build and test
cargo test
# Build and run the debug version
cargo run
# Build and run the release version
cargo run --release

Committing

This project adheres to the Conventional Commits specifications.

All commit messages should follow the following template:

[optional type: ]<description>

[optional body]
  • No need for a scope part.
  • Only the feat and fix types are used.
  • Description should start with an upper case character and should not finish with a period.

Generating Changelog

This project follows the Keep a Changelog principle.

In order to generate a changelog, after committing your latest changes, run the following commands.

git-chglog -c .chglog/changelog.yml > ./CHANGELOG.md