summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
98cd823)
Now that conversion to eval cache is finished
we can reintroduce this optimization.
bench:
5149248
Key posKey;
Move ttMove, move, bestMove;
Value bestValue, value, ttValue, futilityValue, futilityBase, oldAlpha;
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
Depth ttDepth;
// To flag BOUND_EXACT a node with eval above alpha and no available moves
ss->currentMove = bestMove = MOVE_NONE;
ss->ply = (ss-1)->ply + 1;
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<false, false>() || ss->ply > MAX_PLY)
// Check for an instant draw or maximum ply reached
if (pos.is_draw<false, false>() || ss->ply > MAX_PLY)
- 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)
// Stand pat. Return immediately if static value is at least beta
if (bestValue >= beta)
// Futility pruning
if ( !PvNode
&& !InCheck
// Futility pruning
if ( !PvNode
&& !InCheck
&& !givesCheck
&& move != ttMove
&& enoughMaterial
&& !givesCheck
&& move != ttMove
&& enoughMaterial