diff options
Diffstat (limited to 'src/game.rs')
-rw-r--r-- | src/game.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/game.rs b/src/game.rs index 7ab7725..f49f582 100644 --- a/src/game.rs +++ b/src/game.rs @@ -434,8 +434,6 @@ impl GameBoard { } pub fn simulate_snowballs(&mut self, actions: [Action; 2]) { - let map_clone: Map = self.map; - for player_index in 0..actions.len() { if let Action::Snowball(p) = actions[player_index] { if self.map.at(p).is_some() { @@ -697,6 +695,17 @@ impl GameBoard { .map(|(dir, _range)| Command::new(Action::Shoot(dir))) .collect() } + + // TODO: Include snowball commands + pub fn valid_moves(&self, player_index: usize) -> Vec<Command> { + self.valid_shoot_commands(player_index) + .iter() + .chain(self.valid_move_commands(player_index).iter()) + .chain(self.valid_bomb_commands(player_index).iter()) + .chain([Command::new(Action::DoNothing)].iter()) + .cloned() + .collect() + } } #[cfg(test)] |