Skip to content
Snippets Groups Projects
Commit 063e1cb8 authored by Finn Bear's avatar Finn Bear
Browse files

Remove extraenous blank grid state.

parent 32ccab9d
No related branches found
No related tags found
No related merge requests found
......@@ -25,11 +25,7 @@ pub struct Automata {
conway_portrait: Option<TextureHandle>,
}
#[derive(Default)]
enum AutomataState {
/// Nothing on the grid.
#[default]
Empty,
/// Random colors on the grid, but no simulation.
Static {
/// When started fading in "alive" arrow.
......@@ -54,9 +50,15 @@ impl Default for Automata {
// Unique identifier for the grid.
life.name = "life";
randomize_grid(&mut life);
Self {
life,
state: AutomataState::default(),
state: AutomataState::Static {
alive: None,
dead: None,
rules: [None; 3],
},
governor: Governor::default(),
conway_portrait: None,
}
......@@ -66,15 +68,6 @@ impl Default for Automata {
impl Slide for Automata {
fn transition(&mut self, ctx: &Context) -> bool {
match &mut self.state {
AutomataState::Empty => {
self.state = AutomataState::Static {
alive: None,
dead: None,
rules: [None; 3],
};
randomize_grid(&mut self.life);
}
AutomataState::Static { alive, dead, rules } => {
// Enable arrows/text one by one.
if alive.is_none() {
......@@ -135,7 +128,6 @@ impl Slide for Automata {
const HORIZONTAL_OFFSET: f32 = 250.0;
match &mut self.state {
AutomataState::Empty => {}
AutomataState::Static { rules, .. } => {
if let Some(first_rule_fade_start) = rules[0] {
let elapsed = ui.ctx().input().time - first_rule_fade_start;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment