X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=2c2321ee9ca0bb5f48bd99b4fc068986a8d2a297;hp=ea0c64f1ea01c610e3a11b7744a5e282589fb5f6;hb=0dbc72d82e7f5f314499b22a04dcef45edcdba9a;hpb=389e60741f308bb23904baec0d52552935162e0f diff --git a/src/search.cpp b/src/search.cpp index ea0c64f1..2c2321ee 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -271,7 +271,7 @@ void MainThread::search() { // Check if there are threads with a better score than main thread if ( Options["MultiPV"] == 1 && !Limits.depth - && !Skill(Options["Skill Level"]).enabled() + && !(Skill(Options["Skill Level"]).enabled() || Options["UCI_LimitStrength"]) && rootMoves[0].pv[0] != MOVE_NONE) { std::map votes; @@ -335,11 +335,18 @@ void Thread::search() { beta = VALUE_INFINITE; multiPV = Options["MultiPV"]; + // Pick integer skill levels, but non-deterministically round up or down // such that the average integer skill corresponds to the input floating point one. + // UCI_Elo is converted to a suitable fractional skill level, using anchoring + // to CCRL Elo (goldfish 1.13 = 2000) and a fit through Ordo derived Elo + // for match (TC 60+0.6) results spanning a wide range of k values. PRNG rng(now()); - int intLevel = int(Options["Skill Level"]) + - ((Options["Skill Level"] - int(Options["Skill Level"])) * 1024 > rng.rand() % 1024 ? 1 : 0); + double floatLevel = Options["UCI_LimitStrength"] ? + clamp(std::pow((Options["UCI_Elo"] - 1346.6) / 143.4, 1 / 0.806), 0.0, 20.0) : + double(Options["Skill Level"]); + int intLevel = int(floatLevel) + + ((floatLevel - int(floatLevel)) * 1024 > rng.rand() % 1024 ? 1 : 0); Skill skill(intLevel); // When playing with strength handicap enable MultiPV search that we will @@ -503,7 +510,7 @@ void Thread::search() { // If the bestMove is stable over several iterations, reduce time accordingly timeReduction = lastBestMoveDepth + 10 * ONE_PLY < completedDepth ? 1.95 : 1.0; - double reduction = std::pow(mainThread->previousTimeReduction, 0.528) / timeReduction; + double reduction = (1.25 + mainThread->previousTimeReduction) / (2.25 * timeReduction); // Use part of the gained time from a previous stable move for the current move for (Thread* th : Threads) @@ -1134,9 +1141,8 @@ moves_loop: // When in check, search starts from here if (doLMR && !captureOrPromotion) { - int bonus = stat_bonus(newDepth) / 2; - if (value <= alpha) - bonus = -bonus; + int bonus = value > alpha ? stat_bonus(newDepth) + : -stat_bonus(newDepth); update_continuation_histories(ss, movedPiece, to_sq(move), bonus); }