- if (Options["OwnBook"] && !Limits.infinite && !Limits.mate)
- {
- Move bookMove = book.probe(RootPos, Options["Book File"], Options["Best Book Move"]);
-
- if (bookMove && std::count(RootMoves.begin(), RootMoves.end(), bookMove))
- {
- std::swap(RootMoves[0], *std::find(RootMoves.begin(), RootMoves.end(), bookMove));
- goto finalize;
- }
- }
-
- if (Options["Contempt Factor"] && !Options["UCI_AnalyseMode"])
- {
- int cf = Options["Contempt Factor"] * PawnValueMg / 100; // From centipawns
- cf = cf * Material::game_phase(RootPos) / PHASE_MIDGAME; // Scale down with phase
- DrawValue[ RootColor] = VALUE_DRAW - Value(cf);
- DrawValue[~RootColor] = VALUE_DRAW + Value(cf);
- }
- else
- DrawValue[WHITE] = DrawValue[BLACK] = VALUE_DRAW;
-
- if (Options["Write Search Log"])
- {
- Log log(Options["Search Log Filename"]);
- log << "\nSearching: " << RootPos.fen()
- << "\ninfinite: " << Limits.infinite
- << " ponder: " << Limits.ponder
- << " time: " << Limits.time[RootColor]
- << " increment: " << Limits.inc[RootColor]
- << " moves to go: " << Limits.movestogo
- << std::endl;
- }
-
- // Reset the threads, still sleeping: will be wake up at split time
- for (size_t i = 0; i < Threads.size(); i++)