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> {
|
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;
|
let mut board = self.board;
|
||||||
for (m, c) in hist {
|
for (m, c) in hist {
|
||||||
if let Some(m) = m {
|
if let Some(m) = m {
|
||||||
board.place(m, c).expect("move would not propegate");
|
board.place(m, c).expect("move would not propegate");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(board)
|
board
|
||||||
} else {
|
})
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the best move which is a child of `self.current_root`
|
/// Return the best move which is a child of `self.current_root`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user