From 9fff0007464699c2a99ce2d2797833ee4d40efde Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 22 Apr 2025 15:51:10 -0400 Subject: [PATCH] simplify FutureMoves::get_board_from_idx --- src/logic/future_moves.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/logic/future_moves.rs b/src/logic/future_moves.rs index 2fb4834..1ce69a2 100644 --- a/src/logic/future_moves.rs +++ b/src/logic/future_moves.rs @@ -357,17 +357,15 @@ impl FutureMoves { } fn get_board_from_idx(&self, idx: usize) -> Option { - 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`