simplify FutureMoves::get_board_from_idx
This commit is contained in:
parent
cf21f981e5
commit
9fff000746
@ -357,17 +357,15 @@ impl FutureMoves {
|
||||
}
|
||||
|
||||
fn get_board_from_idx(&self, idx: usize) -> Option<Board> {
|
||||
if let Some(hist) = self.move_history(idx) {
|
||||
self.move_history(idx).map(|hist| {
|
||||
let mut board = self.board;
|
||||
for (m, c) in hist {
|
||||
if let Some(m) = m {
|
||||
board.place(m, c).expect("move would not propegate");
|
||||
}
|
||||
}
|
||||
Some(board)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
board
|
||||
})
|
||||
}
|
||||
|
||||
/// Return the best move which is a child of `self.current_root`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user