mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 00:56:39 +08:00
Restore deterministic search state
Introduce helper function Search::reset() which clears all kind of search memory, in order to restore a deterministic search state. Generalize TT.clear() into Search::reset() for the following use cases: - bench: needed to guarantee deterministic bench (ie. if you call bench from interactive command line twice in a row you get the same value). - Clear Hash: restore clean search state, which is the purpose of this button. - ucinewgame: ditto. No functional change. Resolves #346
This commit is contained in:
@@ -181,6 +181,18 @@ void Search::init() {
|
||||
}
|
||||
|
||||
|
||||
/// Search::reset() clears all search memory, to restore a deterministic state
|
||||
|
||||
void Search::reset () {
|
||||
|
||||
TT.clear();
|
||||
History.clear();
|
||||
CounterMovesHistory.clear();
|
||||
Gains.clear();
|
||||
Countermoves.clear();
|
||||
}
|
||||
|
||||
|
||||
/// Search::perft() is our utility to verify move generation. All the leaf nodes
|
||||
/// up to the given depth are generated and counted and the sum returned.
|
||||
template<bool Root>
|
||||
|
||||
Reference in New Issue
Block a user