X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=42f5b2575889464ff6e53826ecf68ae52d9c0e56;hp=bda4c4c508afa206d38d8ab6d6862a5b7be02bdb;hb=8141bdd179da8f36c04f99d51812b19bbd1a8efd;hpb=28543cddc647771658d5521398b725881a839c1c diff --git a/src/search.cpp b/src/search.cpp index bda4c4c5..42f5b257 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -584,8 +584,7 @@ namespace { if ( Threads.stop.load(std::memory_order_relaxed) || pos.is_draw(ss->ply) || ss->ply >= MAX_PLY) - return (ss->ply >= MAX_PLY && !inCheck) ? evaluate(pos) - 10 * ((ss-1)->statScore > 0) - : VALUE_DRAW; + return (ss->ply >= MAX_PLY && !inCheck) ? evaluate(pos) : VALUE_DRAW; // Step 3. Mate distance pruning. Even if we mate at the next move our score // would be at best mate_in(ss->ply+1), but if alpha is already bigger because @@ -705,15 +704,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)) - 10 * ((ss-1)->statScore > 0); + 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 +722,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 +765,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 +814,7 @@ namespace { while ( (move = mp.next_move()) != MOVE_NONE && probCutCount < 3) - if (pos.legal(move)) + if (move != excludedMove && pos.legal(move)) { probCutCount++; @@ -900,7 +905,7 @@ moves_loop: // When in check, search starts from here // Singular extension search (~60 Elo). If all moves but one fail low on a // search of (alpha-s, beta-s), and just one fails high on (alpha, beta), // then that move is singular and should be extended. To verify this we do - // a reduced search on on all the other moves but the ttMove and if the + // a reduced search on all the other moves but the ttMove and if the // result is lower than ttValue minus a margin then we will extend the ttMove. if ( depth >= 8 * ONE_PLY && move == ttMove