[][src]Struct rlifesrc_lib::Config

pub struct Config {
    pub width: isize,
    pub height: isize,
    pub period: isize,
    pub dx: isize,
    pub dy: isize,
    pub transform: Transform,
    pub symmetry: Symmetry,
    pub search_order: Option<SearchOrder>,
    pub new_state: NewState,
    pub max_cell_count: Option<usize>,
    pub non_empty_front: bool,
    pub reduce_max: bool,
    pub rule_string: String,
}

World configuration.

The world will be generated from this configuration.

Fields

width: isize

Width.

height: isize

Height.

period: isize

Period.

dx: isize

Horizontal translation.

dy: isize

Vertical translation.

transform: Transform

Transformations (rotations and reflections) after the last generation.

After the last generation, the pattern will return to the first generation, applying this transformation first, and then the translation defined by dx and dy.

symmetry: Symmetry

Symmetries of the pattern.

search_order: Option<SearchOrder>

The order to find a new unknown cell.

It will always search all generations of a cell first, and then go to another cell.

None means that it will automatically choose a search order according to the width and height of the world.

new_state: NewState

How to choose a state for an unknown cell.

max_cell_count: Option<usize>

The number of minimum living cells in all generations must not exceed this number.

None means that there is no limit for the cell count.

non_empty_front: bool

Whether to force the first row/column to be nonempty.

Here 'front' means the first row or column to search, according to the search order.

reduce_max: bool

Whether to automatically reduce the max_cell_count when a result is found.

The max_cell_count will be set to the cell count of the current result minus one.

rule_string: String

The rule string of the cellular automaton.

Methods

impl Config[src]

pub fn new(width: isize, height: isize, period: isize) -> Self[src]

Sets up a new configuration with given size.

pub fn set_translate(self, dx: isize, dy: isize) -> Self[src]

Sets the translations (dx, dy).

pub fn set_transform(self, transform: Transform) -> Self[src]

Sets the transformation.

pub fn set_symmetry(self, symmetry: Symmetry) -> Self[src]

Sets the symmetry.

pub fn set_search_order(self, search_order: Option<SearchOrder>) -> Self[src]

Sets the search order.

pub fn set_new_state(self, new_state: NewState) -> Self[src]

Sets how to choose a state for an unknown cell.

pub fn set_max_cell_count(self, max_cell_count: Option<usize>) -> Self[src]

Sets the maximal number of living cells.

pub fn set_non_empty_front(self, non_empty_front: bool) -> Self[src]

Sets whether to force the first row/column to be nonempty.

pub fn set_reduce_max(self, reduce_max: bool) -> Self[src]

Sets whether to automatically reduce the max_cell_count when a result is found.

pub fn set_rule_string(self, rule_string: String) -> Self[src]

Sets the rule string.

pub fn world(&self) -> Result<Box<dyn Search>, Box<dyn Error>>[src]

Creates a new world from the configuration. Returns an error if the rule string is invalid.

In rules that contain B0, cells outside the search range are considered Dead in even generations, Alive in odd generations. In other rules, all cells outside the search range are Dead.

After the last generation, the pattern will return to the first generation, applying the transformation first, and then the translation defined by dx and dy.

Trait Implementations

impl Clone for Config[src]

impl Default for Config[src]

impl Eq for Config[src]

impl PartialEq<Config> for Config[src]

impl Debug for Config[src]

impl StructuralPartialEq for Config[src]

impl StructuralEq for Config[src]

Auto Trait Implementations

impl Send for Config

impl Sync for Config

impl Unpin for Config

impl UnwindSafe for Config

impl RefUnwindSafe for Config

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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