Trait rlifesrc_lib::Search [−][src]
A trait for World
.
So that we can switch between different rule types using trait objects.
Required methods
fn search(&mut self, max_step: Option<u64>) -> Status
[src]
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.
fn get_cell_state(&self, coord: Coord) -> Option<State>
[src]
Gets the state of a cell. Returns Err(())
if there is no such cell.
fn config(&self) -> &Config
[src]
World configuration.
fn is_gen_rule(&self) -> bool
[src]
Whether the rule is a Generations rule.
fn is_b0_rule(&self) -> bool
[src]
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.
fn cell_count_gen(&self, t: i32) -> u32
[src]
Number of known living cells in some generation.
For Generations rules, dying cells are not counted.
fn cell_count(&self) -> u32
[src]
Minumum number of known living cells in all generation.
For Generations rules, dying cells are not counted.
fn conflicts(&self) -> u64
[src]
Number of conflicts during the search.
fn set_max_cell_count(&mut self, max_cell_count: Option<u32>)
[src]
Set the max cell counts.
Currently this is the only parameter that you can change during the search.
fn ser(&self) -> WorldSer
[src]
Saves the world as a WorldSer
,
which can be easily serialized.
fn deser(&mut self, ser: &WorldSer) -> Result<(), Error>
[src]
Restores the world from the WorldSer
.
Provided methods
fn rle_gen(&self, t: i32) -> String
[src]
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
o
for rules with 2 states,A
for 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
!
.
fn plaintext_gen(&self, t: i32) -> String
[src]
Displays the whole world in some generation in Plaintext format.
- Dead cells are represented by
.
; - Living and Dying cells are represented by
o
; - Unknown cells are represented by
?
.