From f4c4a2953c20a7083c4671057d6f8464f20a4c10 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Fri, 12 Jul 2019 21:53:46 +0200 Subject: Had bombs destroy health packs --- src/game.rs | 4 +--- src/strategy/minimax.rs | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/game.rs b/src/game.rs index 2158b8b..2a6aebb 100644 --- a/src/game.rs +++ b/src/game.rs @@ -319,11 +319,8 @@ impl GameBoard { fn simulate_bombs(&mut self, actions: [Action; 2]) { // NB: Damage radius has the cell distance rounded UP, throwing range has the cell distance rounded DOWN - // TODO: Destroy health packs - let map_clone = self.map.clone(); - // TODO: iter, filter_map, filter, filter_map... flatten this block down a smidge. for player_index in 0..actions.len() { if let Action::Bomb(p) = actions[player_index] { if self.map.at(p).is_some() { @@ -340,6 +337,7 @@ impl GameBoard { self.map.clear(target); self.players[player_index].moves_score += DIG_SCORE; } + self.powerups.retain(|powerup| powerup.position != target); let target_own_worm: Option<&mut Worm> = self.players[player_index] .worms diff --git a/src/strategy/minimax.rs b/src/strategy/minimax.rs index 11e19a1..80d8246 100644 --- a/src/strategy/minimax.rs +++ b/src/strategy/minimax.rs @@ -229,6 +229,7 @@ fn best_player_move(node: &Node) -> Command { fn score(state: &GameBoard) -> Score { // TODO: Try adding new features here, like max worm health, weighted in some way + // TODO: Distance to dirt heatmap Score { val: match state.outcome { SimulationOutcome::PlayerWon(0) => 2000., -- cgit v1.2.3