Move best = MOVE_NONE;
};
- // EasyMoveManager structure is used to detect an 'easy move'. When the PV is
- // stable across multiple search iterations, we can quickly return the best move.
+ // EasyMoveManager structure is used to detect an 'easy move'. When the PV is stable
+ // across multiple search iterations, we can quickly return the best move.
struct EasyMoveManager {
void clear() {
for (int d = 0; d < 16; ++d)
{
- FutilityMoveCounts[0][d] = int(2.4 + 0.773 * pow(d + 0.00, 1.8));
- FutilityMoveCounts[1][d] = int(2.9 + 1.045 * pow(d + 0.49, 1.8));
+ FutilityMoveCounts[0][d] = int(2.4 + 0.74 * pow(d, 1.78));
+ FutilityMoveCounts[1][d] = int(5.0 + 1.00 * pow(d, 2.00));
}
}
// Penalty for a quiet ttMove that fails low
else if (!pos.capture_or_promotion(ttMove))
{
- Value penalty = -stat_bonus(depth + ONE_PLY);
+ Value penalty = -stat_bonus(depth);
thisThread->history.update(pos.side_to_move(), ttMove, penalty);
update_cm_stats(ss, pos.moved_piece(ttMove), to_sq(ttMove), penalty);
}
moveCountPruning = depth < 16 * ONE_PLY
&& moveCount >= FutilityMoveCounts[improving][depth / ONE_PLY];
- // Step 12. Extensions
- // Extend checks
- if ( givesCheck
- && !moveCountPruning
- && pos.see_ge(move, VALUE_ZERO))
- extension = ONE_PLY;
+ // Step 12. Singular and Gives Check Extensions
// Singular extension search. 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
// ttValue minus a margin then we extend the ttMove.
if ( singularExtensionNode
&& move == ttMove
- && !extension
&& pos.legal(move))
{
Value rBeta = std::max(ttValue - 2 * depth / ONE_PLY, -VALUE_MATE);
if (value < rBeta)
extension = ONE_PLY;
}
+ else if ( givesCheck
+ && !moveCountPruning
+ && pos.see_ge(move, VALUE_ZERO))
+ extension = ONE_PLY;
// Calculate new depth for this move
newDepth = depth - ONE_PLY + extension;
// Step 13. Pruning at shallow depth
if ( !rootNode
+ && pos.non_pawn_material(pos.side_to_move())
&& bestValue > VALUE_MATED_IN_MAX_PLY)
{
if ( !captureOrPromotion
&& cm_ok)
update_cm_stats(ss-1, pos.piece_on(prevSq), prevSq, stat_bonus(depth));
- tte->save(posKey, value_to_tt(bestValue, ss->ply),
- bestValue >= beta ? BOUND_LOWER :
- PvNode && bestMove ? BOUND_EXACT : BOUND_UPPER,
- depth, bestMove, ss->staticEval, TT.generation());
+ if(!excludedMove)
+ tte->save(posKey, value_to_tt(bestValue, ss->ply),
+ bestValue >= beta ? BOUND_LOWER :
+ PvNode && bestMove ? BOUND_EXACT : BOUND_UPPER,
+ depth, bestMove, ss->staticEval, TT.generation());
assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);