#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Life(World<Life, LifeSrc>)

A World with Life rule and LifeSrc algorithm.

§

LifeGen(World<LifeGen, LifeSrc>)

A World with LifeGen rule and LifeSrc algorithm.

§

NtLife(World<NtLife, LifeSrc>)

A World with NtLife rule and LifeSrc algorithm.

§

NtLifeGen(World<NtLifeGen, LifeSrc>)

A World with NtLifeGen rule and LifeSrc algorithm.

§

LifeBackjump(World<Life, Backjump<Life>>)

A World with Life rule and Backjump algorithm.

§

NtLifeBackjump(World<NtLife, Backjump<NtLife>>)

A World with NtLife rule and Backjump algorithm.

Implementations§

source§

impl PolyWorld

source

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.

source

pub fn get_cell_state(&self, coord: Coord) -> Option<State>

Gets the state of a cell. Returns Err(()) if there is no such cell.

source

pub const fn config(&self) -> &Config

World configuration.

source

pub const fn is_gen_rule(&self) -> bool

Whether the rule is a Generations rule.

source

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.

source

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.

source

pub fn cell_count(&self) -> u32

Minimum number of known living cells in all generation.

For Generations rules, dying cells are not counted.

source

pub const fn conflicts(&self) -> u64

Number of conflicts during the search.

source

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.

source

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 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 !.
source

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 ?.
source

pub fn ser(&self) -> WorldSer

Available on crate feature serde only.

Saves the world as a WorldSer, which can be easily serialized.

source

pub fn deser(&mut self, ser: &WorldSer) -> Result<(), Error>

Available on crate feature serde only.

Restores the world from the WorldSer.

Trait Implementations§

source§

impl From<World<Life, Backjump<Life>>> for PolyWorld

Convert into LifeBackjump variant.

source§

fn from(v: World<Life, Backjump<Life>>) -> Self

Converts to this type from the input type.
source§

impl From<World<Life, LifeSrc>> for PolyWorld

Convert into Life variant.

source§

fn from(v: World<Life, LifeSrc>) -> Self

Converts to this type from the input type.
source§

impl From<World<LifeGen, LifeSrc>> for PolyWorld

Convert into LifeGen variant.

source§

fn from(v: World<LifeGen, LifeSrc>) -> Self

Converts to this type from the input type.
source§

impl From<World<NtLife, Backjump<NtLife>>> for PolyWorld

Convert into NtLifeBackjump variant.

source§

fn from(v: World<NtLife, Backjump<NtLife>>) -> Self

Converts to this type from the input type.
source§

impl From<World<NtLife, LifeSrc>> for PolyWorld

Convert into NtLife variant.

source§

fn from(v: World<NtLife, LifeSrc>) -> Self

Converts to this type from the input type.
source§

impl From<World<NtLifeGen, LifeSrc>> for PolyWorld

Convert into NtLifeGen variant.

source§

fn from(v: World<NtLifeGen, LifeSrc>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V