X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fsearch.cpp;h=2c2321ee9ca0bb5f48bd99b4fc068986a8d2a297;hb=0dbc72d82e7f5f314499b22a04dcef45edcdba9a;hp=df19108fb2db4dd28642c1ef20b34f49aa5f2a53;hpb=650aeaf2420bdac00de03963132d82a415193a1c;p=stockfish diff --git a/src/search.cpp b/src/search.cpp index df19108f..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