else
break;
- delta += delta / 4 + 2;
+ delta += delta / 3;
assert(alpha >= -VALUE_INFINITE && beta <= VALUE_INFINITE);
}
// At non-PV nodes we check for an early TT cutoff
if ( !PvNode
- && ss->ttHit
&& !excludedMove
&& tte->depth() > depth - (tte->bound() == BOUND_EXACT)
- && ttValue != VALUE_NONE // Possible in case of TT access race
+ && ttValue != VALUE_NONE // Possible in case of TT access race or if !ttHit
&& (tte->bound() & (ttValue >= beta ? BOUND_LOWER : BOUND_UPPER)))
{
// If ttMove is quiet, update move sorting heuristics on TT hit (~2 Elo)
// there and in further interactions with transposition table cutoff depth is set to depth - 3
// because probCut search has depth set to depth - 4 but we also do a move before it
// so effective depth is equal to depth - 3
- && !( ss->ttHit
- && tte->depth() >= depth - 3
+ && !( tte->depth() >= depth - 3
&& ttValue != VALUE_NONE
&& ttValue < probCutBeta))
{
probCutBeta = beta + 430;
if ( ss->inCheck
&& !PvNode
- && depth >= 2
&& ttCapture
&& (tte->bound() & BOUND_LOWER)
&& tte->depth() >= depth - 4
moveCountPruning = moveCount >= futility_move_count(improving, depth);
// Reduced depth of the next LMR search
- int lmrDepth = std::max(newDepth - r, 0);
+ int lmrDepth = newDepth - r;
if ( capture
|| givesCheck)
&& lmrDepth < 7
&& !ss->inCheck
&& ss->staticEval + 207 + 223 * lmrDepth + PieceValue[EG][pos.piece_on(to_sq(move))]
- + captureHistory[movedPiece][to_sq(move)][type_of(pos.piece_on(to_sq(move)))] * 1078 / 7000 < alpha)
+ + captureHistory[movedPiece][to_sq(move)][type_of(pos.piece_on(to_sq(move)))] / 7 < alpha)
continue;
Bitboard occupied;
// SEE based pruning (~11 Elo)
if (!pos.see_ge(move, occupied, Value(-205) * depth))
{
- if (depth < 2 - capture)
- continue;
- // Don't prune the move if opp. King/Queen/Rook gets a discovered attack during or after the exchanges
+ // Don't prune the move if opponent King/Queen/Rook gets a discovered attack during or after the exchanges
Bitboard leftEnemies = pos.pieces(~us, KING, QUEEN, ROOK);
Bitboard attacks = 0;
occupied |= to_sq(move);
{
Square sq = pop_lsb(leftEnemies);
attacks = pos.attackers_to(sq, occupied) & pos.pieces(us) & occupied;
- // Exclude Queen/Rook(s) which were already threatened before SEE (opp King can't be in check when it's our turn)
+ // Exclude Queen/Rook(s) which were already threatened before SEE (opponent King can't be in check when it's our turn)
if (attacks && sq != pos.square<KING>(~us) && (pos.attackers_to(sq, pos.pieces()) & pos.pieces(us)))
attacks = 0;
}
lmrDepth = std::max(lmrDepth, 0);
// Prune moves with negative SEE (~4 Elo)
- if (!pos.see_ge(move, Value(-27 * lmrDepth * lmrDepth - 33 * lmrDepth / 2)))
+ if (!pos.see_ge(move, Value(-27 * lmrDepth * lmrDepth - 16 * lmrDepth)))
continue;
}
}
else
{
// Reduce other moves if we have found at least one score improvement (~1 Elo)
+ // Reduce more for depth > 3 and depth < 12 (~1 Elo)
if ( depth > 1
&& beta < 14001
&& value > -12754)
- depth -= 1;
+ depth -= depth > 3 && depth < 12 ? 2 : 1;
assert(depth > 0);
alpha = value; // Update alpha! Always alpha < beta
// At non-PV nodes we check for an early TT cutoff
if ( !PvNode
- && ss->ttHit
&& tte->depth() >= ttDepth
- && ttValue != VALUE_NONE // Only in case of TT access race
+ && ttValue != VALUE_NONE // Only in case of TT access race or if !ttHit
&& (tte->bound() & (ttValue >= beta ? BOUND_LOWER : BOUND_UPPER)))
return ttValue;