mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Fix book move with searchmoves compatibility
Do not return the book move if is not among the RootMoves,in particular if we have been asked to search on a move subset with "searchmoves" then return book move only if it is among this subset. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
af4fadebda
commit
1ae6ae9b60
1 changed files with 7 additions and 6 deletions
|
@ -328,13 +328,12 @@ void Search::think() {
|
||||||
book.open(Options["Book File"].value<string>());
|
book.open(Options["Book File"].value<string>());
|
||||||
|
|
||||||
Move bookMove = book.probe(pos, Options["Best Book Move"].value<bool>());
|
Move bookMove = book.probe(pos, Options["Best Book Move"].value<bool>());
|
||||||
if (bookMove != MOVE_NONE)
|
|
||||||
{
|
|
||||||
if (!Signals.stop && (Limits.ponder || Limits.infinite))
|
|
||||||
Threads.wait_for_stop_or_ponderhit();
|
|
||||||
|
|
||||||
cout << "bestmove " << bookMove << endl;
|
if ( bookMove != MOVE_NONE
|
||||||
return;
|
&& std::count(RootMoves.begin(), RootMoves.end(), bookMove))
|
||||||
|
{
|
||||||
|
std::swap(RootMoves[0], *std::find(RootMoves.begin(), RootMoves.end(), bookMove));
|
||||||
|
goto finish;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,6 +403,8 @@ void Search::think() {
|
||||||
pos.undo_move(RootMoves[0].pv[0]);
|
pos.undo_move(RootMoves[0].pv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finish:
|
||||||
|
|
||||||
// When we reach max depth we arrive here even without a StopRequest, but if
|
// When we reach max depth we arrive here even without a StopRequest, but if
|
||||||
// we are pondering or in infinite search, we shouldn't print the best move
|
// we are pondering or in infinite search, we shouldn't print the best move
|
||||||
// before we are told to do so.
|
// before we are told to do so.
|
||||||
|
|
Loading…
Add table
Reference in a new issue