From e8b28dbbcde3d00a9d82637644734b6c7e79b544 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Tue, 6 Aug 2019 20:15:39 +0200 Subject: All valid moves list into the game sim --- src/strategy/minimax.rs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'src/strategy/minimax.rs') diff --git a/src/strategy/minimax.rs b/src/strategy/minimax.rs index 8a45750..4b10014 100644 --- a/src/strategy/minimax.rs +++ b/src/strategy/minimax.rs @@ -283,7 +283,8 @@ fn pruned_moves(state: &GameBoard, player_index: usize) -> Vec { let my_starting_health = state.players[player_index].health(); let opponent_starting_health = state.players[opponent_index].health(); - valid_moves(state, player_index) + state + .valid_moves(player_index) .into_iter() .filter(|command| { //NB: These rules should pass for doing nothing, otherwise @@ -300,14 +301,3 @@ fn pruned_moves(state: &GameBoard, player_index: usize) -> Vec { }) .collect() } - -fn valid_moves(state: &GameBoard, player_index: usize) -> Vec { - state - .valid_shoot_commands(player_index) - .iter() - .chain(state.valid_move_commands(player_index).iter()) - .chain(state.valid_bomb_commands(player_index).iter()) - .chain([Command::new(Action::DoNothing)].iter()) - .cloned() - .collect() -} -- cgit v1.2.3