X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=f0224d8c72d3d9fdba241800fde5b3feac540b69;hp=567f87660197e719cf83ab492191bd3d26945b30;hb=9d791386825ef9797e62706654df8af8d36b6268;hpb=43c186c64503cffe6991c338f1813e36f8f49a29 diff --git a/src/search.cpp b/src/search.cpp index 567f8766..f0224d8c 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -87,10 +87,9 @@ namespace { // Skill structure is used to implement strength limit struct Skill { - Skill(int l) : level(l) {} + explicit Skill(int l) : level(l) {} bool enabled() const { return level < 20; } bool time_to_pick(Depth depth) const { return depth / ONE_PLY == 1 + level; } - Move best_move(size_t multiPV) { return best ? best : pick_best(multiPV); } Move pick_best(size_t multiPV); int level; @@ -514,8 +513,8 @@ void Thread::search() { // If skill level is enabled, swap best PV line with the sub-optimal one if (skill.enabled()) - std::swap(rootMoves[0], *std::find(rootMoves.begin(), - rootMoves.end(), skill.best_move(multiPV))); + std::swap(rootMoves[0], *std::find(rootMoves.begin(), rootMoves.end(), + skill.best ? skill.best : skill.pick_best(multiPV))); } @@ -1451,7 +1450,7 @@ moves_loop: // When in check search starts from here int push = ( weakness * int(topScore - rootMoves[i].score) + delta * (rng.rand() % weakness)) / 128; - if (rootMoves[i].score + push > maxScore) + if (rootMoves[i].score + push >= maxScore) { maxScore = rootMoves[i].score + push; best = rootMoves[i].pv[0];