From: Marco Costalba Date: Sat, 1 Dec 2012 17:06:29 +0000 (+0100) Subject: Reintroduce eval optimizaion from null search X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=23bdd064426c6fb5b6fd860d156c9f50bb58d0db;hp=98cd8239cc351f337132bb8cf08be728580c078d Reintroduce eval optimizaion from null search Now that conversion to eval cache is finished we can reintroduce this optimization. bench: 5149248 --- diff --git a/src/search.cpp b/src/search.cpp index 52e7600b..f6c2233b 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1090,7 +1090,7 @@ split_point_start: // At split points actual search starts from here Key posKey; Move ttMove, move, bestMove; Value bestValue, value, ttValue, futilityValue, futilityBase, oldAlpha; - bool givesCheck, enoughMaterial, evasionPrunable; + bool givesCheck, enoughMaterial, evasionPrunable, fromNull; Depth ttDepth; // To flag BOUND_EXACT a node with eval above alpha and no available moves @@ -1099,6 +1099,7 @@ split_point_start: // At split points actual search starts from here ss->currentMove = bestMove = MOVE_NONE; ss->ply = (ss-1)->ply + 1; + fromNull = (ss-1)->currentMove == MOVE_NULL; // Check for an instant draw or maximum ply reached if (pos.is_draw() || ss->ply > MAX_PLY) @@ -1136,7 +1137,14 @@ split_point_start: // At split points actual search starts from here } else { - ss->staticEval = bestValue = evaluate(pos, ss->evalMargin); + if (fromNull) + { + // Approximated score. Real one is slightly higher due to tempo + ss->staticEval = bestValue = -(ss-1)->staticEval; + ss->evalMargin = VALUE_ZERO; + } + else + ss->staticEval = bestValue = evaluate(pos, ss->evalMargin); // Stand pat. Return immediately if static value is at least beta if (bestValue >= beta) @@ -1171,6 +1179,7 @@ split_point_start: // At split points actual search starts from here // Futility pruning if ( !PvNode && !InCheck + && !fromNull && !givesCheck && move != ttMove && enoughMaterial