summaryrefslogtreecommitdiff
path: root/src/strategy.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/strategy.rs')
-rw-r--r--src/strategy.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/strategy.rs b/src/strategy.rs
index d6f92a6..3506e75 100644
--- a/src/strategy.rs
+++ b/src/strategy.rs
@@ -217,8 +217,8 @@ fn valid_moves(state: &GameBoard, player_index: usize) -> Vec<Command> {
_ => None
})
.collect::<Vec<_>>();
- let mut shoots = Direction::all().iter()
- .filter(|dir| state.find_target(worm.position, **dir, worm.weapon_range).is_some())
+ let mut shoots = state.find_targets(worm.position, worm.weapon_range)
+ .iter()
.map(|d| Command::Shoot(*d))
.collect::<Vec<_>>();
moves.append(&mut shoots);