if (rootDepth >= 4)
{
Value previousScore = rootMoves[pvIdx].previousScore;
- delta = Value(21 * (1 + rootPos.captures_to_hand()) + abs(previousScore) / 128);
- delta = Value(21 + abs(previousScore) / 256);
++ delta = Value(21 * (1 + rootPos.captures_to_hand()) + abs(previousScore) / 256);
alpha = std::max(previousScore - delta,-VALUE_INFINITE);
beta = std::min(previousScore + delta, VALUE_INFINITE);
improving = (ss-2)->staticEval == VALUE_NONE ? (ss->staticEval >= (ss-4)->staticEval
|| (ss-4)->staticEval == VALUE_NONE) : ss->staticEval >= (ss-2)->staticEval;
+ // Skip early pruning in case of mandatory capture
+ if (pos.must_capture() && MoveList<CAPTURES>(pos).size())
+ goto moves_loop;
+
// Step 8. Futility pruning: child node (~30 Elo)
if ( !PvNode
- && depth < 7
+ && depth < 6
- && eval - futility_margin(depth, improving) >= beta
+ && !( pos.extinction_value() == -VALUE_MATE
+ && pos.extinction_piece_types().find(ALL_PIECES) == pos.extinction_piece_types().end())
+ && (pos.checking_permitted() || !pos.capture_the_flag_piece())
+ && eval - futility_margin(depth, improving) * (1 + pos.check_counting()) >= beta
&& eval < VALUE_KNOWN_WIN) // Do not return unproven wins
return eval;
// Step 9. Null move search with verification search (~40 Elo)
if ( !PvNode
&& (ss-1)->currentMove != MOVE_NULL
- && (ss-1)->statScore < 22661
+ && (ss-1)->statScore < 23405
&& eval >= beta
&& eval >= ss->staticEval
- && ss->staticEval >= beta - 33 * depth + 299 - improving * 30
+ && ss->staticEval >= beta - 32 * depth + 317 - improving * 30
&& !excludedMove
&& pos.non_pawn_material(us)
+ && (pos.pieces(~us) ^ pos.pieces(~us, PAWN))
+ && (pos.pieces() ^ pos.pieces(BREAKTHROUGH_PIECE) ^ pos.pieces(CLOBBER_PIECE))
&& (ss->ply >= thisThread->nmpMinPly || us != thisThread->nmpColor))
{
assert(eval - beta >= 0);
// Null move dynamic reduction based on depth and value
- Depth R = (835 - 150 * !pos.checking_permitted() + 70 * depth) / 256 + std::min(int(eval - beta) / 185, 3);
- Depth R = (854 + 68 * depth) / 258 + std::min(int(eval - beta) / 192, 3);
++ Depth R = (854 - 150 * !pos.checking_permitted() + 68 * depth) / 258 + std::min(int(eval - beta) / 192, 3);
ss->currentMove = MOVE_NULL;
ss->continuationHistory = &thisThread->continuationHistory[0][0][NO_PIECE][0];
// much above beta, we can (almost) safely prune the previous move.
if ( !PvNode
&& depth >= 5
+ && (pos.pieces() ^ pos.pieces(CLOBBER_PIECE))
&& abs(beta) < VALUE_MATE_IN_MAX_PLY)
{
- Value raisedBeta = std::min(beta + (191 + 20 * !!pos.capture_the_flag_piece()) * (1 + pos.check_counting() + (pos.extinction_value() != VALUE_NONE)) - 46 * improving, VALUE_INFINITE);
- Value raisedBeta = std::min(beta + 189 - 45 * improving, VALUE_INFINITE);
++ Value raisedBeta = std::min(beta + (189 + 20 * !!pos.capture_the_flag_piece()) * (1 + pos.check_counting() + (pos.extinction_value() != VALUE_NONE)) - 45 * improving, VALUE_INFINITE);
MovePicker mp(pos, ttMove, raisedBeta - ss->staticEval, &thisThread->captureHistory);
int probCutCount = 0;
// Futility pruning: parent node (~2 Elo)
if ( lmrDepth < 6
&& !inCheck
+ && !( pos.extinction_value() == -VALUE_MATE
+ && pos.extinction_piece_types().find(ALL_PIECES) == pos.extinction_piece_types().end())
- && ss->staticEval + 250 + 211 * lmrDepth <= alpha)
+ && ss->staticEval + 255 + 182 * lmrDepth <= alpha)
continue;
// Prune moves with negative SEE (~10 Elo)
- if (!pos.must_capture() && !pos.see_ge(move, Value(-(31 - std::min(lmrDepth, 18)) * lmrDepth * lmrDepth)))
- if (!pos.see_ge(move, Value(-(32 - std::min(lmrDepth, 18)) * lmrDepth * lmrDepth)))
++ if (!pos.must_capture() && !pos.see_ge(move, Value(-(32 - std::min(lmrDepth, 18)) * lmrDepth * lmrDepth)))
continue;
}
- else if ( !(givesCheck && extension)
- && !pos.must_capture()
- && !pos.see_ge(move, Value(-199 - 120 * pos.captures_to_hand()) * depth)) // (~20 Elo)
- else if (!pos.see_ge(move, Value(-194) * depth)) // (~20 Elo)
++ else if ( !pos.must_capture()
++ && !pos.see_ge(move, Value(-194 - 120 * pos.captures_to_hand()) * depth)) // (~20 Elo)
continue;
}
|| moveCountPruning
|| ss->staticEval + PieceValue[EG][pos.captured_piece()] <= alpha
|| cutNode
- || thisThread->ttHitAverage < 384 * ttHitAverageResolution * ttHitAverageWindow / 1024)
- || thisThread->ttHitAverage < 375 * ttHitAverageResolution * ttHitAverageWindow / 1024))
++ || thisThread->ttHitAverage < 375 * ttHitAverageResolution * ttHitAverageWindow / 1024)
+ && !(pos.must_capture() && MoveList<CAPTURES>(pos).size()))
{
Depth r = reduction(improving, depth, moveCount);
r -= 2;
ss->statScore = thisThread->mainHistory[us][from_to(move)]
- + (*contHist[0])[movedPiece][to_sq(move)]
- + (*contHist[1])[movedPiece][to_sq(move)]
- + (*contHist[3])[movedPiece][to_sq(move)]
+ + (*contHist[0])[history_slot(movedPiece)][to_sq(move)]
+ + (*contHist[1])[history_slot(movedPiece)][to_sq(move)]
+ + (*contHist[3])[history_slot(movedPiece)][to_sq(move)]
- - 4729;
+ - 4926;
// Reset statScore to zero if negative and most stats shows >= 0
if ( ss->statScore < 0