Crates.io | smeagol |
lib.rs | smeagol |
version | 0.1.2 |
source | src |
created_at | 2019-02-22 04:38:48.965968 |
updated_at | 2019-02-27 22:33:08.992123 |
description | Conway's Game of Life using HashLife and SIMD. |
homepage | |
repository | https://github.com/billyrieger/smeagol |
max_upload_size | |
id | 116419 |
size | 883,250 |
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.
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:
See the documentation for more.
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.
smeagol
is licensed under the Mozilla Public License version 2.0. See the license
file and the MPL 2.0
FAQ for more details.