diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2019-07-12 21:53:46 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2019-07-12 21:53:46 +0200 |
commit | f4c4a2953c20a7083c4671057d6f8464f20a4c10 (patch) | |
tree | f3a58dbabefc6289fc47695d688e890539e839d3 | |
parent | 627ddc31b34ceb283ed062be5ef09d1ca9d40378 (diff) |
Had bombs destroy health packs
-rw-r--r-- | src/game.rs | 4 | ||||
-rw-r--r-- | 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., |