}
}
- probCutBeta = beta + 209 - 44 * improving;
+ probCutBeta = beta + (209 + 20 * !!pos.capture_the_flag_piece() + 50 * pos.captures_to_hand()) * (1 + pos.check_counting() + pos.extinction_single_piece()) - 44 * improving;
- // Step 9. ProbCut (~10 Elo)
+ // Step 9. ProbCut (~4 Elo)
// If we have a good enough capture and a reduced search returns a value
// much above beta, we can (almost) safely prune the previous move.
if ( !PvNode
}
else
{
- // Countermoves based pruning (~20 Elo)
- if ( lmrDepth < 4 + ((ss-1)->statScore > 0 || (ss-1)->moveCount == 1)
+ // Continuation history based pruning (~20 Elo)
+ if ( lmrDepth < 4
- && (*contHist[0])[movedPiece][to_sq(move)] < CounterMovePruneThreshold
- && (*contHist[1])[movedPiece][to_sq(move)] < CounterMovePruneThreshold)
+ && (*contHist[0])[history_slot(movedPiece)][to_sq(move)] < CounterMovePruneThreshold
+ && (*contHist[1])[history_slot(movedPiece)][to_sq(move)] < CounterMovePruneThreshold)
continue;
// Futility pruning: parent node (~5 Elo)
if (cutNode)
r += 2;
- // Decrease reduction for moves that escape a capture. Filter out
- // castling moves, because they are coded as "king captures rook" and
- // hence break reverse_move() (~2 Elo)
- else if ( type_of(move) == NORMAL
- && !pos.see_ge(reverse_move(move)))
- r -= 2 + ss->ttPv - (type_of(movedPiece) == PAWN);
-
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)]
- 4741;
- // Decrease/increase reduction by comparing opponent's stat score (~10 Elo)
- if (ss->statScore >= -89 && (ss-1)->statScore < -116)
- r--;
-
- else if ((ss-1)->statScore >= -112 && ss->statScore < -100)
- r++;
-
// Decrease/increase reduction for moves with a good/bad history (~30 Elo)
- // If we are not in check use statScore, but if we are in check we use
- // the sum of main history and first continuation history with an offset.
- if (ss->inCheck)
- r -= (thisThread->mainHistory[us][from_to(move)]
- + (*contHist[0])[history_slot(movedPiece)][to_sq(move)] - 3833) / 16384;
- else
+ if (!ss->inCheck)
- r -= ss->statScore / 14790;
+ r -= ss->statScore / (14790 - 4434 * pos.captures_to_hand());
}
// In general we want to cap the LMR depth search at newDepth. But if
ss->currentMove = move;
ss->continuationHistory = &thisThread->continuationHistory[ss->inCheck]
[captureOrPromotion]
- [pos.moved_piece(move)]
+ [history_slot(pos.moved_piece(move))]
[to_sq(move)];
- // CounterMove based pruning
+ // Continuation history based pruning
if ( !captureOrPromotion
&& bestValue > VALUE_TB_LOSS_IN_MAX_PLY
- && (*contHist[0])[pos.moved_piece(move)][to_sq(move)] < CounterMovePruneThreshold
- && (*contHist[1])[pos.moved_piece(move)][to_sq(move)] < CounterMovePruneThreshold)
+ && (*contHist[0])[history_slot(pos.moved_piece(move))][to_sq(move)] < CounterMovePruneThreshold
+ && (*contHist[1])[history_slot(pos.moved_piece(move))][to_sq(move)] < CounterMovePruneThreshold)
continue;
// Make and search the move