Trait gridsim::Sim
[−]
[src]
pub trait Sim {
type Cell;
type Diff;
fn step(_: [[&Self::Cell; 3]; 3]) -> Self::Diff;
fn update(_: &mut Self::Cell, _: Self::Diff);
}Defines a simulation for complicated things that have too much state to abandon on the next cycle.
This enforces a rule in that all new cells are only produced from old board state. This prevents the update order from breaking the simulation.
Associated Types
type Cell
The type of cells on the grid
type Diff
Represents all information necessary to modify a cell in the previous grid to produce the version in the next.
Required Methods
fn step(_: [[&Self::Cell; 3]; 3]) -> Self::Diff
Performs one step of the simulation by producing a grid of diffs that can be used to change the cells to their next state.
fn update(_: &mut Self::Cell, _: Self::Diff)
Updates a cell with a diff.