X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=1303e1fb08f7c587ea02b192fca7d8ec32c7e90c;hp=507339504600cb2e49bc1cbe5c6558e59784fd86;hb=4bef7aa5cd682617502cacfa4413c0d2c78401ca;hpb=3ac3b68540e93770e5a806196537c0e9a2d81a67 diff --git a/src/search.cpp b/src/search.cpp index 50733950..1303e1fb 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -705,15 +705,16 @@ namespace { // Step 6. Static evaluation of the position if (inCheck) { - ss->staticEval = pureStaticEval = eval = VALUE_NONE; + ss->staticEval = eval = pureStaticEval = VALUE_NONE; improving = false; goto moves_loop; // Skip early pruning when in check } else if (ttHit) { // Never assume anything on values stored in TT - if ((ss->staticEval = pureStaticEval = eval = tte->eval()) == VALUE_NONE) - eval = ss->staticEval = pureStaticEval = evaluate(pos); + ss->staticEval = eval = pureStaticEval = tte->eval(); + if (eval == VALUE_NONE) + ss->staticEval = eval = pureStaticEval = evaluate(pos); // Can ttValue be used as a better position evaluation? if ( ttValue != VALUE_NONE @@ -722,12 +723,17 @@ namespace { } else { - int p = (ss-1)->statScore; - int malus = p > 0 ? (p + 5000) / 1024 : - p < 0 ? (p - 5000) / 1024 : 0; + if ((ss-1)->currentMove != MOVE_NULL) + { + int p = (ss-1)->statScore; + int bonus = p > 0 ? (-p - 2500) / 512 : + p < 0 ? (-p + 2500) / 512 : 0; - ss->staticEval = eval = (ss-1)->currentMove != MOVE_NULL ? (pureStaticEval = evaluate(pos)) - malus - : (pureStaticEval = -(ss-1)->staticEval + 2 * Eval::Tempo); + pureStaticEval = evaluate(pos); + ss->staticEval = eval = pureStaticEval + bonus; + } + else + ss->staticEval = eval = pureStaticEval = -(ss-1)->staticEval + 2 * Eval::Tempo; tte->save(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, pureStaticEval); } @@ -760,7 +766,7 @@ namespace { assert(eval - beta >= 0); // Null move dynamic reduction based on depth and value - Depth R = ((823 + 67 * depth / ONE_PLY) / 256 + std::min((eval - beta) / PawnValueMg, 3)) * ONE_PLY; + Depth R = ((823 + 67 * depth / ONE_PLY) / 256 + std::min(int(eval - beta) / 200, 3)) * ONE_PLY; ss->currentMove = MOVE_NULL; ss->continuationHistory = &thisThread->continuationHistory[NO_PIECE][0]; @@ -809,7 +815,7 @@ namespace { while ( (move = mp.next_move()) != MOVE_NONE && probCutCount < 3) - if (pos.legal(move)) + if (move != excludedMove && pos.legal(move)) { probCutCount++;