Enum rlifesrc_lib::poly_world::PolyWorld
source · #[non_exhaustive]pub enum PolyWorld {
Life(World<Life, LifeSrc>),
LifeGen(World<LifeGen, LifeSrc>),
NtLife(World<NtLife, LifeSrc>),
NtLifeGen(World<NtLifeGen, LifeSrc>),
LifeBackjump(World<Life, Backjump<Life>>),
NtLifeBackjump(World<NtLife, Backjump<NtLife>>),
}Expand description
A polymorphic World.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Life(World<Life, LifeSrc>)
LifeGen(World<LifeGen, LifeSrc>)
NtLife(World<NtLife, LifeSrc>)
NtLifeGen(World<NtLifeGen, LifeSrc>)
LifeBackjump(World<Life, Backjump<Life>>)
NtLifeBackjump(World<NtLife, Backjump<NtLife>>)
Implementations§
source§impl PolyWorld
impl PolyWorld
sourcepub fn search(&mut self, max_step: Option<u64>) -> Status
pub fn search(&mut self, max_step: Option<u64>) -> Status
The search function.
Returns Status::Found if a result is found,
Status::None if such pattern does not exist,
Status::Searching if the number of steps exceeds max_step
and no results are found.
sourcepub fn get_cell_state(&self, coord: Coord) -> Option<State>
pub fn get_cell_state(&self, coord: Coord) -> Option<State>
Gets the state of a cell. Returns Err(()) if there is no such cell.
sourcepub const fn is_gen_rule(&self) -> bool
pub const fn is_gen_rule(&self) -> bool
Whether the rule is a Generations rule.
sourcepub fn is_b0_rule(&self) -> bool
pub fn is_b0_rule(&self) -> bool
Whether the rule contains B0.
In other words, whether a cell would become ALIVE in the next
generation, if all its neighbors in this generation are dead.
sourcepub fn cell_count_gen(&self, t: i32) -> u32
pub fn cell_count_gen(&self, t: i32) -> u32
Number of known living cells in some generation.
For Generations rules, dying cells are not counted.
sourcepub fn cell_count(&self) -> u32
pub fn cell_count(&self) -> u32
Minimum number of known living cells in all generation.
For Generations rules, dying cells are not counted.
sourcepub fn set_max_cell_count(&mut self, max_cell_count: Option<u32>)
pub fn set_max_cell_count(&mut self, max_cell_count: Option<u32>)
Set the max cell counts.
Currently this is the only parameter that you can change during the search.
sourcepub fn rle_gen(&self, t: i32) -> String
pub fn rle_gen(&self, t: i32) -> String
Displays the whole world in some generation, in a mix of Plaintext and RLE format.
- Dead cells are represented by
.; - Living cells are represented by
ofor rules with 2 states,Afor rules with more states; - Dying cells are represented by uppercase letters starting from
B; - Unknown cells are represented by
?; - Each line is ended with
$; - The whole pattern is ended with
!.
sourcepub fn plaintext_gen(&self, t: i32) -> String
pub fn plaintext_gen(&self, t: i32) -> String
Displays the whole world in some generation in Plaintext format.
Do not use this for Generations rules.
- Dead cells are represented by
.; - Living and Dying cells are represented by
o; - Unknown cells are represented by
?.