Skip to content

Commit

Permalink
Simplify passing a clone of game to iterative_deepening
Browse files Browse the repository at this point in the history
  • Loading branch information
jgilchrist committed Dec 1, 2024
1 parent ec7a011 commit 6772177
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/engine/search/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,10 @@ pub fn search(
return mv;
}

// The game is modified as moves are played during search. When the search terminates,
// the game will be left in a dirty state since we will not undo the moves played to
// reach the terminating node in the search tree. To keep our original 'game' copy clean
// we perform the search on a copy of the game.
let mut search_game = game.clone();

iterative_deepening::search(
&mut search_game,
// Give the search its own copy of the game so we don't get one returned in a dirty state
// when the search aborts.
&mut game.clone(),
persistent_state,
search_restrictions,
options,
Expand Down

0 comments on commit 6772177

Please sign in to comment.