#parser #conway #game-of-life

game-of-life-parsers

Collection of parsers for Conway's game of life

5 releases (3 stable)

Uses old Rust 2015

2.0.1 Oct 22, 2017
2.0.0 Oct 18, 2017
1.0.0 Oct 11, 2017
0.2.0 Oct 9, 2017
0.1.1 Sep 24, 2017

#20 in #game-of-life

MIT license

19KB
502 lines

Game of Life parsers

Build Status Documentation

Collection of parsers for Conway's game of life.

Currently supported file formats:

  • Life 1.05
  • Life 1.06

Usage

extern crate game_of_life_parsers;
// use std::fs::File;
use game_of_life_parsers::{Parser, Life105Parser};

fn main() {
    // let file = File::open("file.life").unwrap();
    let file = "#N\n#P 0 0\n..*".as_bytes();
    let mut parser = Life105Parser::new();
    let game_descriptor = parser.parse(Box::new(file)).unwrap();
    for live_cell in game_descriptor.live_cells() {
        // iterate overe live cells
    }
}

lib.rs:

Collection of parsers for Conway's game of life.

Currently supported file formats:

  • Life 1.05

Usage

extern crate game_of_life_parsers;
// use std::fs::File;
use game_of_life_parsers::{Parser, Life105Parser};

fn main() {
	// let file = File::open("file.life").unwrap();
	let file = "#N\n#P 0 0\n..*".as_bytes();
	let mut parser = Life105Parser::new();
	let game_descriptor =  parser.parse(Box::new(file)).unwrap();
	for live_cell in game_descriptor.live_cells() {
		// iterate overe live cells
   	}
}

Dependencies

~5–11MB
~137K SLoC