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]

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

Auto Trait Implementations

impl RefUnwindSafe for GameOfLife

impl Send for GameOfLife

impl Sync for GameOfLife

impl Unpin for GameOfLife

impl UnwindSafe for GameOfLife

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.