A backend implementation of Conway's Game of Life.
This library provides several functionalities for Life-like cellular automata, including Conway's Game of Life.
The following operations are supported:
"B3/S23"
)It does not provide frontend functionality for viewing or editing patterns through a user interface.
Creating a new game from the pattern file, advancing it and show the last state:
```rust use lifebackend::format; use lifebackend::{Board, Game, Position};
// Read a pattern file let handler = format::open("patterns/glider.rle")?;
// Create a new game (the type parameter is i16
)
let rule = handler.rule();
let board = handler
.livecells()
.map(Position::tryfrom)
.collect::
// Advance the generation let generation = 4; for _ in 0..generation { game.advance(); }
// Print the last state let bbox = game.board().bounding_box(); let population = game.board().iter().count(); println!("Generation {generation}: bounding-box = {bbox}, population = {population}"); println!("{game}"); ```
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.