diff --git a/src/logic/future_moves.rs b/src/logic/future_moves.rs index 11b2750..17bdd49 100644 --- a/src/logic/future_moves.rs +++ b/src/logic/future_moves.rs @@ -372,7 +372,7 @@ impl FutureMoves { }); if let Some(curr_board_idx) = curr_board { - self.root_from_child_idx_board(curr_board_idx, *board); + self.root_from_child_idx(curr_board_idx); false } else { if self.config.print && !self.arena.is_empty() { @@ -397,7 +397,10 @@ impl FutureMoves { self.board = board; } - fn root_from_child_idx_board(&mut self, idx: usize, board: Board) { + fn root_from_child_idx(&mut self, idx: usize) { + let board = self + .get_board_from_idx(idx) + .expect("unable to get board at idx"); self.current_depth -= self.depth_of(idx); self.current_root = Some(idx); self.board = board; @@ -638,11 +641,7 @@ mod tests { assert_eq!(futm.arena_len(), 5); // move to a child - futm.root_from_child_idx_board( - 1, - futm.get_board_from_idx(1) - .expect("unable to get board from child"), - ); + futm.root_from_child_idx(1); futm.refocus_tree(); assert_eq!(futm.arena_len(), 1);