From a516e9a639226505964144d16bffacee82c058a5 Mon Sep 17 00:00:00 2001 From: Justin Wernick Date: Sat, 11 Apr 2020 14:18:57 +0200 Subject: Better move heuristics --- src/state.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/state.rs') diff --git a/src/state.rs b/src/state.rs index ecbd408..99239ae 100644 --- a/src/state.rs +++ b/src/state.rs @@ -38,6 +38,10 @@ pub struct Position { impl GameState { pub fn update(&mut self, commands: [Command; 2]) { + if self.status != GameStatus::Continue { + return; + } + self.do_command(0, &commands[0]); self.do_command(1, &commands[1]); self.update_player_collisions(); @@ -64,7 +68,6 @@ impl GameState { use Command::*; self.players[player_index].tick_boost(); - // TODO: Command validation assertions match command { Nothing => {} Accelerate => self.players[player_index].accelerate(), -- cgit v1.2.3