X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=a30694b6b3c6f55d0776ce83a7b716380238288e;hp=677455ec05b0c26bb3722df69f6645a86f0c14d9;hb=8b2adcf99ebb58d0d9ba6ec4138427f469fc34ce;hpb=1d368bbbdc50bbb4e10933c4986abc07a08010fd diff --git a/src/search.cpp b/src/search.cpp index 677455ec..a30694b6 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -238,7 +238,6 @@ namespace { SearchLimits Limits; // Log file - bool UseLogFile; std::ofstream LogFile; // Skill level adjustment @@ -488,7 +487,6 @@ bool think(Position& pos, const SearchLimits& limits, Move searchMoves[]) { PawnEndgameExtension[0] = Options["Pawn Endgame Extension (non-PV nodes)"].value(); UCIMultiPV = Options["MultiPV"].value(); SkillLevel = Options["Skill level"].value(); - UseLogFile = Options["Use Search Log"].value(); read_evaluation_uci_options(pos.side_to_move()); @@ -516,18 +514,19 @@ bool think(Position& pos, const SearchLimits& limits, Move searchMoves[]) { } // Write to log file and keep it open to be accessed during the search - if (UseLogFile) + if (Options["Use Search Log"].value()) { std::string name = Options["Search Log Filename"].value(); LogFile.open(name.c_str(), std::ios::out | std::ios::app); - LogFile << "\nSearching: " << pos.to_fen() - << "\ninfinite: " << Limits.infinite - << " ponder: " << Limits.ponder - << " time: " << Limits.time - << " increment: " << Limits.increment - << " moves to go: " << Limits.movesToGo - << endl; + if (LogFile.is_open()) + LogFile << "\nSearching: " << pos.to_fen() + << "\ninfinite: " << Limits.infinite + << " ponder: " << Limits.ponder + << " time: " << Limits.time + << " increment: " << Limits.increment + << " moves to go: " << Limits.movesToGo + << endl; } // We're ready to start thinking. Call the iterative deepening loop function @@ -537,7 +536,7 @@ bool think(Position& pos, const SearchLimits& limits, Move searchMoves[]) { cout << "info" << speed_to_uci(pos.nodes_searched()) << endl; // Write final search statistics and close log file - if (UseLogFile) + if (LogFile.is_open()) { int t = current_search_time(); @@ -687,7 +686,7 @@ namespace { for (int i = 0; i < Min(UCIMultiPV, (int)Rml.size()); i++) cout << Rml[i].pv_info_to_uci(pos, depth, selDepth, alpha, beta, i) << endl; - if (UseLogFile) + if (LogFile.is_open()) LogFile << pretty_pv(pos, depth, value, current_search_time(), Rml[0].pv) << endl; // Init easyMove after first iteration or drop if differs from the best move