Move movesSearched[64];
StateInfo st;
+ Eval::Info ei;
const TTEntry *tte;
SplitPoint* splitPoint;
Key posKey;
bestValue = -VALUE_INFINITE;
ss->currentMove = threatMove = (ss+1)->excludedMove = bestMove = MOVE_NONE;
ss->ply = (ss-1)->ply + 1;
+ ss->ei = &ei;
(ss+1)->skipNullMove = false; (ss+1)->reduction = DEPTH_ZERO;
(ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE;
// Never assume anything on values stored in TT
if ( (ss->staticEval = eval = tte->eval_value()) == VALUE_NONE
||(ss->evalMargin = tte->eval_margin()) == VALUE_NONE)
- eval = ss->staticEval = evaluate(pos, ss->evalMargin);
+ eval = ss->staticEval = evaluate(pos, ss->evalMargin, &ei);
// Can ttValue be used as a better position evaluation?
if (ttValue != VALUE_NONE)
}
else
{
- eval = ss->staticEval = evaluate(pos, ss->evalMargin);
+ eval = ss->staticEval = evaluate(pos, ss->evalMargin, &ei);
TT.store(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE,
ss->staticEval, ss->evalMargin);
}
&& !ss->skipNullMove
&& depth < 4 * ONE_PLY
&& !inCheck
- && eval - FutilityMargins[depth][(ss-1)->futMc] >= beta
+ && eval - futility_margin(depth, (ss-1)->futilityMoveCount) >= beta
&& abs(beta) < VALUE_MATE_IN_MAX_PLY
&& pos.non_pawn_material(pos.side_to_move()))
- return eval - FutilityMargins[depth][(ss-1)->futMc];
+ return eval - futility_margin(depth, (ss-1)->futilityMoveCount);
// Step 8. Null move search with verification search (is omitted in PV nodes)
if ( !PvNode
<< " currmovenumber " << moveCount + PVIdx << sync_endl;
}
+ ss->futilityMoveCount = 0;
ext = DEPTH_ZERO;
captureOrPromotion = pos.is_capture_or_promotion(move);
givesCheck = pos.move_gives_check(move, ci);
// Update current move (this must be done after singular extension search)
newDepth = depth - ONE_PLY + ext;
- ss->futMc = 0;
-
// Step 13. Futility pruning (is omitted in PV nodes)
if ( !PvNode
&& !captureOrPromotion
// Value based pruning
// We illogically ignore reduction condition depth >= 3*ONE_PLY for predicted depth,
// but fixing this made program slightly weaker.
- ss->futMc = moveCount;
-
Depth predictedDepth = newDepth - reduction<PvNode>(depth, moveCount);
futilityValue = ss->staticEval + ss->evalMargin + futility_margin(predictedDepth, moveCount)
+ Gain[pos.piece_moved(move)][to_sq(move)];
continue;
}
+
+ // We have not pruned the move that will be searched, but remember how
+ // far in the move list we are to be more aggressive in the child node.
+ ss->futilityMoveCount = moveCount;
}
// Check for legality only before to do the move
assert(depth <= DEPTH_ZERO);
StateInfo st;
+ Eval::Info ei;
const TTEntry* tte;
Key posKey;
Move ttMove, move, bestMove;
// Never assume anything on values stored in TT
if ( (ss->staticEval = bestValue = tte->eval_value()) == VALUE_NONE
||(ss->evalMargin = tte->eval_margin()) == VALUE_NONE)
- ss->staticEval = bestValue = evaluate(pos, ss->evalMargin);
+ ss->staticEval = bestValue = evaluate(pos, ss->evalMargin, &ei);
}
else
- ss->staticEval = bestValue = evaluate(pos, ss->evalMargin);
+ ss->staticEval = bestValue = evaluate(pos, ss->evalMargin, &ei);
// Stand pat. Return immediately if static value is at least beta
if (bestValue >= beta)