antbox_state/state.rs
1use antbox_cellauto::{ConwaysLife, Evolvable};
2use derive_more::{From, Into};
3use derive_new::new;
4
5/// The `antbox` functional, I/O-free [State]
6#[derive(Debug, From, Into, new)]
7pub struct State {
8 /// The generation count
9 pub gencnt: usize,
10 /// The food grid
11 pub food: ConwaysLife,
12}
13
14impl Evolvable for State {
15 fn evolve(&self) -> Self {
16 State {
17 gencnt: self.gencnt + 1,
18 food: self.food.evolve(),
19 }
20 }
21}