smeagol

Crates.iosmeagol
lib.rssmeagol
version0.1.2
sourcesrc
created_at2019-02-22 04:38:48.965968
updated_at2019-02-27 22:33:08.992123
descriptionConway's Game of Life using HashLife and SIMD.
homepage
repositoryhttps://github.com/billyrieger/smeagol
max_upload_size
id116419
size883,250
Billy Rieger (billyrieger)

documentation

README

smeagol

Build status Coverage Lines of code Version Documentation License Dependency status Rust version

Introduction

smeagol is a Rust library built to efficiently simulate large patterns in the cellular automaton Conway's Game of Life. It uses the HashLife algorithm developed by Bill Gosper to achieve tremendous speedups for repetitive patterns. A good explanation of HashLife can be found here. It also uses SIMD instructions to speed up the base case of evolving a 16 by 16 square grid of cells into the future.

Usage

Add smeagol to your Cargo.toml:

[dependencies]
smeagol = "0.1"

Then, start simulating Conway's Game of Life!

fn main() -> Result<(), failure::Error> {
    // load a pattern
    let mut life = smeagol::Life::from_rle_file("breeder1.rle")?;

    // step 1024 generations into the future
    life.set_step_log_2(10);
    life.step();

    // save the result
    let bbox = life.bounding_box().unwrap().pad(10);
    life.save_png("breeder1.png", bbox, 0)?;

    Ok(())
}

This produces the following image:

Breeder

See the documentation for more.

Limitations

Currently there is no garbage collection. Large patterns will eventually crash the program if left running. This will be fixed in the future.

Only the Life rule B3/S23 is supported.

License

smeagol is licensed under the Mozilla Public License version 2.0. See the license file and the MPL 2.0 FAQ for more details.

Commit count: 159

cargo fmt