Struct rlifesrc_lib::Config[][src]

pub struct Config {
    pub width: i32,
    pub height: i32,
    pub period: i32,
    pub dx: i32,
    pub dy: i32,
    pub transform: Transform,
    pub symmetry: Symmetry,
    pub search_order: Option<SearchOrder>,
    pub new_state: NewState,
    pub max_cell_count: Option<u32>,
    pub reduce_max: bool,
    pub rule_string: String,
    pub diagonal_width: Option<i32>,
    pub skip_subperiod: bool,
    pub skip_subsymmetry: bool,
    pub known_cells: Vec<KnownCell>,
    pub backjump: bool,
}

World configuration.

The world will be generated from this configuration.

Fields

width: i32

Width.

height: i32

Height.

period: i32

Period.

dx: i32

Horizontal translation.

dy: i32

Vertical translation.

transform: Transform

Transformations (rotations and reflections) after the last generation in a period.

After the last generation in a period, 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 one cell before going 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<u32>

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.

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.

diagonal_width: Option<i32>

Diagonal width.

If the diagonal width is n, the cells at position (x, y) where abs(x - y) >= n are assumed to be dead.

skip_subperiod: bool

Whether to skip patterns whose fundamental period are smaller than the given period.

skip_subsymmetry: bool

Whether to skip patterns which are invariant under more transformations than required by the given symmetry.

In another word, whether to skip patterns whose symmetry group properly contains the given symmetry group.

known_cells: Vec<KnownCell>

Cells whose states are known before the search.

backjump: bool

(Experimental) Whether to enable backjumping.

Backjumping will reduce the number of steps, but each step will takes a much longer time. The current implementation is slower for most search, only useful for large (e.g., 64x64) still lifes.

Currently it is only supported for non-generations rules. Generations rules will ignore this option.

Implementations

impl Config[src]

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

Sets up a new configuration with given size.

pub fn set_translate(self, dx: i32, dy: i32) -> 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<T: Into<Option<SearchOrder>>>(
    self,
    search_order: T
) -> 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<T: Into<Option<u32>>>(self, max_cell_count: T) -> Self[src]

Sets the maximal number of living cells.

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<S: ToString>(self, rule_string: S) -> Self[src]

Sets the rule string.

pub fn set_diagonal_width<T: Into<Option<i32>>>(self, diagonal_width: T) -> Self[src]

Sets the diagonal width.

pub fn set_skip_subperiod(self, skip_subperiod: bool) -> Self[src]

Sets whether to skip patterns whose fundamental period is smaller than the given period.

pub fn set_skip_subsymmetry(self, skip_subsymmetry: bool) -> Self[src]

Sets whether to skip patterns which are invariant under more transformations than required by the given symmetry.

pub fn set_known_cells<T: Into<Vec<KnownCell>>>(self, known_cells: T) -> Self[src]

Sets cells whose states are known before the search.

pub fn set_backjump(self, backjump: bool) -> Self[src]

Sets whether to enable backjumping.

pub fn require_square_world(&self) -> bool[src]

Whether the configuration requires the world to be square.

pub fn require_no_diagonal_width(&self) -> bool[src]

Whether the configuration requires the world to have no diagonal width.

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

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

Trait Implementations

impl Clone for Config[src]

impl Debug for Config[src]

impl Default for Config[src]

impl<'de> Deserialize<'de> for Config[src]

impl Eq for Config[src]

impl Hash for Config[src]

impl PartialEq<Config> for Config[src]

impl Serialize for Config[src]

impl StructuralEq for Config[src]

impl StructuralPartialEq for Config[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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 = Infallible

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<V, T> VZip<V> for T where
    V: MultiLane<T>,