pub struct CellularAutomaton {
pub x: usize,
pub y: usize,
pub cells: Vec<Vec<i32>>,
pub cell_processor: fn(&Self, usize, usize) -> i32,
/* private fields */
}Fields§
§x: usize§y: usize§cells: Vec<Vec<i32>>Field of simulation with self.x and self.y dimensions.
cell_processor: fn(&Self, usize, usize) -> i32Implementations§
Source§impl CellularAutomaton
Construction
impl CellularAutomaton
Construction
Sourcepub fn new(x: usize, y: usize) -> CellularAutomaton
pub fn new(x: usize, y: usize) -> CellularAutomaton
§Constructor with the given dimensions and default (Conway’s game of life) processor.
Sourcepub fn new_with_processor(
x: usize,
y: usize,
processor: fn(c: &CellularAutomaton, x: usize, y: usize) -> i32,
) -> CellularAutomaton
pub fn new_with_processor( x: usize, y: usize, processor: fn(c: &CellularAutomaton, x: usize, y: usize) -> i32, ) -> CellularAutomaton
§Constructor with the given dimensions and proccesing lambda.
Sourcepub fn set_processor(
&mut self,
processor: fn(c: &CellularAutomaton, x: usize, y: usize) -> i32,
) -> &mut Self
pub fn set_processor( &mut self, processor: fn(c: &CellularAutomaton, x: usize, y: usize) -> i32, ) -> &mut Self
§Sets the cell processor lambda for the automaton.
processor: fn(C:&CellularAutomaton, X:usize, Y:usize) -> NextState:i32
Allows to use multiple strategies for one field, by swapping cell_processor instead of cloning or moving matrices between automatons.
Source§impl CellularAutomaton
Core processing
impl CellularAutomaton
Core processing
Source§impl CellularAutomaton
Field fillings
impl CellularAutomaton
Field fillings
pub fn randomize_prob(&mut self, alive_probability: f64) -> &mut Self
Auto Trait Implementations§
impl Freeze for CellularAutomaton
impl RefUnwindSafe for CellularAutomaton
impl Send for CellularAutomaton
impl Sync for CellularAutomaton
impl Unpin for CellularAutomaton
impl UnwindSafe for CellularAutomaton
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more