mod.rs
2.3 kB · rust · 82 lines
1/// The run of a seed until it fixes, loops or times out.2pub mod animate;3/// The centred cropping and tiling of a run's frames.4pub mod crop;5/// The elementary automata: their stepping, their space-time diagrams and the card of one rule.6pub mod elementary;7/// The cumulative-visit heatmap frames of a run.8pub mod heatmap;9/// The design masks a rule reads and the lattice they generate.10pub mod mask;11/// The entropy, churn and chaos readings of a run.12pub mod metrics;13/// The run config and the recorded life.14pub mod models;15/// The PNG frames and the gif movie of grids and runs.16pub mod render;17/// The named sources of neighbor-count values, and the counts they lay down.18pub mod sequence;19/// The one-generation advance of a grid.20pub mod step;2122use crate::math::two::Cell2d;2324/// Builds the 3 by 3 Moore mask, every site on but the center.25pub fn moore() -> Cell2d {26 Cell2d::new(crate::core::cell::moore(2))27}2829/// The edge policy of a life grid.30#[derive(Clone, Copy, Debug, PartialEq, Eq)]31pub enum Boundary {32 /// The fixed dead border.33 Constant,34 /// The toroidal edge.35 Wrap,36}3738impl Boundary {39 /// Returns whether the edges wrap.40 pub fn wrap(self) -> bool {41 matches!(self, Boundary::Wrap)42 }43}4445/// The ending of a life run.46#[derive(Clone, Copy, Debug, PartialEq, Eq)]47pub enum Fate {48 /// The empty fixed point.49 Dead,50 /// The living fixed point.51 Alive,52 /// The periodic cycle.53 Loop,54 /// The generation cap reached before settling.55 Timeout,56}5758impl Fate {59 /// Returns the fate's lowercase name.60 pub fn name(self) -> &'static str {61 match self {62 Fate::Dead => "dead",63 Fate::Alive => "alive",64 Fate::Loop => "loop",65 Fate::Timeout => "timeout",66 }67 }68}6970pub use animate::animate;71pub use crop::{crop, tessellate};72pub use elementary::{73 affine, corner_bits, cube_orbit, gasket, genus, history, lambda, npn_class, outer_totalistic,74 popcount, reversible, rule_degree, rule_name, single_seed, step, surjective, wolfram_class,75};76pub use heatmap::heatmap;77pub use mask::{design_mask, lattice_index, mask_offsets};78pub use metrics::{churn, entropy};79pub use models::{Config, Life};80pub use render::{frames, frames_of, movie};81pub use sequence::{counts, Counts, Sequence};82pub use step::next_grid;