Crates.io | lexicon |
lib.rs | lexicon |
version | 0.1.2 |
source | src |
created_at | 2021-11-13 01:16:40.804795 |
updated_at | 2021-11-13 19:45:20.281842 |
description | A convenient interface to get patterns from Conway’s Game of Life’s Lexicon. |
homepage | https://github.com/scastiel/lexicon-rs |
repository | https://github.com/scastiel/lexicon-rs |
max_upload_size | |
id | 481236 |
size | 1,683,482 |
A convenient interface to get patterns from the Lexicon and use them in your implementation of Conway’s Game of Life.
Used by Lifeee, my web app implementation of Conway’s Game of Life, check it out!
let lexicon = lexicon::Lexicon::get();
assert_eq!(lexicon.terms.len() > 0, true);
let glider = lexicon.get_term("glider".to_string()).unwrap();
assert_eq!(glider.width, 3);
assert_eq!(glider.height, 3);
assert_eq!(glider.cells, vec![
lexicon::Cell { x: 0, y: 0 },
lexicon::Cell { x: 1, y: 0 },
lexicon::Cell { x: 2, y: 0 },
lexicon::Cell { x: 0, y: 1 },
lexicon::Cell { x: 1, y: 2 }
]);
cargo run
will read the file res/lexicon.txt, parse it and serialize the result into res/lexicon.bin, which will be used by the library then.