X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=34fcc17637211029366f6868bb0bcf8d392cb971;hp=c188469146eb074ae85ea6c72cef191fdaa014a2;hb=65f46794af41534e0dc744c6f7531a4c43eca857;hpb=60c121f3b1ee7d5ced3435cc1718e4e6e6fd8383 diff --git a/src/search.cpp b/src/search.cpp index c1884691..34fcc176 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -152,19 +152,19 @@ uint64_t Search::perft(Position& pos, Depth depth) { CheckInfo ci(pos); const bool leaf = (depth == 2 * ONE_PLY); - for (const ExtMove& ms : MoveList(pos)) + for (const auto& m : MoveList(pos)) { if (Root && depth <= ONE_PLY) cnt = 1, nodes++; else { - pos.do_move(ms.move, st, ci, pos.gives_check(ms.move, ci)); + pos.do_move(m, st, ci, pos.gives_check(m, ci)); cnt = leaf ? MoveList(pos).size() : perft(pos, depth - ONE_PLY); nodes += cnt; - pos.undo_move(ms.move); + pos.undo_move(m); } if (Root) - sync_cout << UCI::move(ms.move, pos.is_chess960()) << ": " << cnt << sync_endl; + sync_cout << UCI::move(m, pos.is_chess960()) << ": " << cnt << sync_endl; } return nodes; } @@ -199,7 +199,7 @@ void Search::think() { if (RootMoves.empty()) { - RootMoves.push_back(MOVE_NONE); + RootMoves.push_back(RootMove(MOVE_NONE)); sync_cout << "info depth 0 score " << UCI::value(RootPos.checkers() ? -VALUE_MATE : VALUE_DRAW) << sync_endl; @@ -1383,15 +1383,13 @@ moves_loop: // When in check and at SpNode search starts from here // then we choose the move with the resulting highest score. for (size_t i = 0; i < multiPV; ++i) { - int score = RootMoves[i].score; - // This is our magic formula - score += ( weakness * int(RootMoves[0].score - score) - + variance * (rng.rand() % weakness)) / 128; + int push = ( weakness * int(RootMoves[0].score - RootMoves[i].score) + + variance * (rng.rand() % weakness)) / 128; - if (score > maxScore) + if (RootMoves[i].score + push > maxScore) { - maxScore = score; + maxScore = RootMoves[i].score + push; best = RootMoves[i].pv[0]; } } @@ -1444,7 +1442,7 @@ string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) { << " nps " << pos.nodes_searched() * 1000 / elapsed; if (elapsed > 1000) // Earlier makes little sense - ss << " hashfull " << TT.hashfull(); + ss << " hashfull " << TT.hashfull(); ss << " tbhits " << TB::Hits << " time " << elapsed