pub struct Life {
pub rows: usize,
pub cols: usize,
pub generation: u64,
/* private fields */
}Fields§
§rows: usize§cols: usize§generation: u64Implementations§
Source§impl Life
impl Life
pub fn random(rows: usize, cols: usize, seed: u64, fill: f32) -> Self
pub fn alive(&self, r: usize, c: usize) -> bool
pub fn alive_count(&self) -> usize
pub fn density(&self) -> f32
Sourcepub fn row_alive_count(&self, r: usize) -> usize
pub fn row_alive_count(&self, r: usize) -> usize
Cells alive in a single row — used as “fitness” per track.
Sourcepub fn col_alive_count(&self, c: usize) -> usize
pub fn col_alive_count(&self, c: usize) -> usize
Cells alive in a single column — used as “present-moment energy”.
Sourcepub fn inject_glider(&mut self, r0: usize, c0: usize)
pub fn inject_glider(&mut self, r0: usize, c0: usize)
Seed a glider near the top-left corner. Useful for non-empty grids that would otherwise die quickly.
Auto Trait Implementations§
impl Freeze for Life
impl RefUnwindSafe for Life
impl Send for Life
impl Sync for Life
impl Unpin for Life
impl UnsafeUnpin for Life
impl UnwindSafe for Life
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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