compb-dla-model/src/system/mod.rs

25 lines
563 B
Rust

use std::ops::Add;
use rand::Rng;
use serde::Serialize;
pub mod walker;
pub mod grid;
pub mod model;
pub mod nd;
mod hexagonal;
pub trait GriddedPosition: Add<Output=Self> + Serialize + Clone {
const NEIGHBOURS: u32;
fn zero() -> Self;
fn spawn<R: Rng>(rng: &mut R, radius: f32) -> Self;
fn abs(&self) -> f32;
fn neighbour(&self, neighbour_index: u32) -> Self;
fn linear_index(&self, grid_size: u32) -> usize;
}
pub trait Storage<P: GriddedPosition> {
fn at(&self, position: &P) -> bool;
fn deposit(&mut self, position: &P);
}