summaryrefslogtreecommitdiff
path: root/src/game.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2019-07-07 14:46:26 +0200
committerJustin Worthe <justin@worthe-it.co.za>2019-07-07 14:46:26 +0200
commit41d9a1254477fd2a7ecd10bf2573dc4b62660465 (patch)
treecc7dcad811e6b1d2fdd4d58fecba40769c1772a1 /src/game.rs
parent352ad4a297511dfe843bad5206879983ad34f3e2 (diff)
Strategy split to allow creating a minimax with pruning strategy
Diffstat (limited to 'src/game.rs')
-rw-r--r--src/game.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/game.rs b/src/game.rs
index 56c583b..4e074ea 100644
--- a/src/game.rs
+++ b/src/game.rs
@@ -320,6 +320,8 @@ impl GameBoard {
// 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] {
@@ -333,9 +335,8 @@ impl GameBoard {
for &(damage_offset, weapon_damage) in BOMB_DAMAGES.iter() {
let target = p + damage_offset;
- if self.map.at(target) == Some(true) {
+ if map_clone.at(target) == Some(true) {
self.map.clear(target);
- // TODO: Fix this so that simultaneous bomb throwing gives points to both players
self.players[player_index].moves_score += DIG_SCORE;
}