simplify FutureMoves::root_from_child_idx_board
This commit is contained in:
parent
82b679095c
commit
a3b75d633f
@ -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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user