simplify update_from_board checking of current_root

This commit is contained in:
Simon Gardling 2025-02-25 10:15:26 -05:00
parent 65ac509fa4
commit 6a00560a8a
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -250,10 +250,9 @@ impl FutureMoves {
.arena
.iter()
.enumerate()
.find(|(_, m)| {
&m.board == board && (m.parent == self.current_root) && self.current_root.is_some()
})
.map(|(idx, _)| idx);
.find(|(_, m)| &m.board == board && (m.parent == self.current_root))
.map(|(idx, _)| idx)
.filter(|_| self.current_root.is_some());
if let Some(curr_board_idx) = curr_board {
self.set_root_idx_raw(curr_board_idx);