Struct gol_lib::GameOfLife [−][src]
pub struct GameOfLife { /* fields omitted */ }Class of game of life.
To create a new game of life with a grid of 25 collumns wide and 45 lines height, use :
fn main(){ let mut game = GameOfLife::new(25, 45); }
Implementations
impl GameOfLife[src]
impl GameOfLife[src]pub fn new(nb_col: usize, nb_lig: usize) -> GameOfLife[src]
pub fn set_element(&mut self, i_col: usize, i_lig: usize)[src]
Function to set the value of an element.
For exemple, to set the element at position 5, 5 (e.g. to make the cell alive), do :
/!\ Pay attention ! : It is the collumn first, and after the line.
fn main(){ let mut game = GameOfLife::new(25, 45); game.set_element(5,5); }
pub fn unset_element(&mut self, i_col: usize, i_lig: usize)[src]
Function to reset the value of an element.
For exemple, to reset the element at position 5, 5 (e.g. to kill the cell), do :
/!\ Pay attention ! : It is the collumn first, and after the line.
fn main(){ let mut game = GameOfLife::new(25, 45); game.unset_element(5,5); }
pub fn show(&self)[src]
Function to show the actual state of the game.
For exemple :
fn main(){ let mut game = GameOfLife::new(25, 45); game.show(); }
pub fn update(&mut self)[src]
Function which update the game (e.g. pass to the next state)
For exemple :
fn main(){ let mut game = GameOfLife::new(25, 45); game.update(); }
pub fn get_grid(&self) -> &Vec<Vec<bool>>[src]
Funtion to get the grid of the automata