X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=c7bc8d1752f8c15e18ecf43baf1d3e0ae8f329d5;hp=f976908ec31b0e5b2a9f9d36235b365461a3d9e7;hb=ad43ce143664953087b44dd3b4324f77c212bd46;hpb=24417a6cd9577e8574eadc26765e366888cc9b1e diff --git a/src/search.cpp b/src/search.cpp index f976908e..c7bc8d17 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -296,12 +296,12 @@ void Search::think() { || count(SearchMoves.begin(), SearchMoves.end(), ml.move())) RootMoves.push_back(RootMove(ml.move())); - if (Options["OwnBook"].value()) + if (Options["OwnBook"]) { - if (Options["Book File"].value() != book.name()) - book.open(Options["Book File"].value()); + if (book.name() != (string)Options["Book File"]) + book.open(Options["Book File"]); - Move bookMove = book.probe(pos, Options["Best Book Move"].value()); + Move bookMove = book.probe(pos, Options["Best Book Move"]); if ( bookMove != MOVE_NONE && count(RootMoves.begin(), RootMoves.end(), bookMove)) @@ -315,24 +315,24 @@ void Search::think() { read_evaluation_uci_options(pos.side_to_move()); Threads.read_uci_options(); - TT.set_size(Options["Hash"].value()); - if (Options["Clear Hash"].value()) + TT.set_size(Options["Hash"]); + if (Options["Clear Hash"]) { Options["Clear Hash"] = false; TT.clear(); } - UCIMultiPV = Options["MultiPV"].value(); - SkillLevel = Options["Skill Level"].value(); + UCIMultiPV = Options["MultiPV"]; + SkillLevel = Options["Skill Level"]; // Do we have to play with skill handicap? In this case enable MultiPV that // we will use behind the scenes to retrieve a set of possible moves. SkillLevelEnabled = (SkillLevel < 20); MultiPV = (SkillLevelEnabled ? std::max(UCIMultiPV, (size_t)4) : UCIMultiPV); - if (Options["Use Search Log"].value()) + if (Options["Use Search Log"]) { - Log log(Options["Search Log Filename"].value()); + Log log(Options["Search Log Filename"]); log << "\nSearching: " << pos.to_fen() << "\ninfinite: " << Limits.infinite << " ponder: " << Limits.ponder @@ -362,11 +362,11 @@ void Search::think() { Threads.set_timer(0); Threads.set_size(1); - if (Options["Use Search Log"].value()) + if (Options["Use Search Log"]) { int e = elapsed_time(); - Log log(Options["Search Log Filename"].value()); + Log log(Options["Search Log Filename"]); log << "Nodes: " << pos.nodes_searched() << "\nNodes/second: " << (e > 0 ? pos.nodes_searched() * 1000 / e : 0) << "\nBest move: " << move_to_san(pos, RootMoves[0].pv[0]); @@ -410,10 +410,10 @@ namespace { bestValue = delta = -VALUE_INFINITE; ss->currentMove = MOVE_NULL; // Hack to skip update gains - // Handle the special case of a mate/stalemate position + // Handle the special case of a mated/stalemate position if (RootMoves.empty()) { - cout << "info depth 0" + cout << "info depth 0 score " << score_to_uci(pos.in_check() ? -VALUE_MATE : VALUE_DRAW) << endl; RootMoves.push_back(MOVE_NONE); @@ -512,7 +512,7 @@ namespace { if (SkillLevelEnabled && depth == 1 + SkillLevel) skillBest = do_skill_level(); - if (Options["Use Search Log"].value()) + if (Options["Use Search Log"]) pv_info_to_log(pos, depth, bestValue, elapsed_time(), &RootMoves[0].pv[0]); // Filter out startup noise when monitoring best move stability @@ -1624,10 +1624,10 @@ split_point_start: // At split points actual search starts from here std::stringstream s; - if (abs(v) < VALUE_MATE - PLY_MAX * ONE_PLY) - s << " score cp " << int(v) * 100 / int(PawnValueMidgame); // Scale to centipawns + if (abs(v) < VALUE_MATE_IN_PLY_MAX) + s << "cp " << v * 100 / int(PawnValueMidgame); else - s << " score mate " << (v > 0 ? VALUE_MATE - v + 1 : -VALUE_MATE - v) / 2; + s << "mate " << (v > 0 ? VALUE_MATE - v + 1 : -VALUE_MATE - v) / 2; s << (v >= beta ? " lowerbound" : v <= alpha ? " upperbound" : ""); @@ -1664,7 +1664,7 @@ split_point_start: // At split points actual search starts from here cout << "info depth " << d << " seldepth " << selDepth - << (i == PVIdx ? score_to_uci(v, alpha, beta) : score_to_uci(v)) + << " score " << (i == PVIdx ? score_to_uci(v, alpha, beta) : score_to_uci(v)) << " nodes " << pos.nodes_searched() << " nps " << (t > 0 ? pos.nodes_searched() * 1000 / t : 0) << " time " << t @@ -1758,7 +1758,7 @@ split_point_start: // At split points actual search starts from here while (m != pv) pos.undo_move(*--m); - Log l(Options["Search Log Filename"].value()); + Log l(Options["Search Log Filename"]); l << s.str() << endl; }