// The former is needed to allow update_continuation_histories(ss-1, ...),
// which accesses its argument at ss-4, also near the root.
// The latter is needed for statScores and killer initialization.
- Stack stack[MAX_PLY+8], *ss = stack+5;
+ Stack stack[MAX_PLY+10], *ss = stack+7;
Move pv[MAX_PLY+1];
Value bestValue, alpha, beta, delta;
Move lastBestMove = MOVE_NONE;
Color us = rootPos.side_to_move();
bool failedLow;
- std::memset(ss-5, 0, 8 * sizeof(Stack));
- for (int i = 5; i > 0; i--)
+ std::memset(ss-7, 0, 10 * sizeof(Stack));
+ for (int i = 7; i > 0; i--)
(ss-i)->continuationHistory = &this->continuationHistory[NO_PIECE][0]; // Use as sentinel
ss->pv = pv;
int probCutCount = 0;
while ( (move = mp.next_move()) != MOVE_NONE
- && probCutCount < 2 + 2 * cutNode)
+ && probCutCount < 2 + 2 * cutNode)
if (move != excludedMove && pos.legal(move))
{
probCutCount++;
// Perform a preliminary qsearch to verify that the move holds
value = -qsearch<NonPV>(pos, ss+1, -raisedBeta, -raisedBeta+1);
- // If the qsearch held perform the regular search
+ // If the qsearch held, perform the regular search
if (value >= raisedBeta)
value = -search<NonPV>(pos, ss+1, -raisedBeta, -raisedBeta+1, depth - 4 * ONE_PLY, !cutNode);
moves_loop: // When in check, search starts from here
- const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory, nullptr, (ss-4)->continuationHistory };
+ const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory,
+ nullptr, (ss-4)->continuationHistory,
+ nullptr, (ss-6)->continuationHistory };
Move countermove = thisThread->counterMoves[pos.piece_on(prevSq)][prevSq];
MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory,
movedPiece = pos.moved_piece(move);
givesCheck = gives_check(pos, move);
- // Skip quiet moves if movecount exceeds our FutilityMoveCount threshold
- moveCountPruning = depth < 16 * ONE_PLY
- && moveCount >= FutilityMoveCounts[improving][depth / ONE_PLY];
-
// Step 13. Extensions (~70 Elo)
// Singular extension search (~60 Elo). If all moves but one fail low on a
&& pos.non_pawn_material(us)
&& bestValue > VALUE_MATED_IN_MAX_PLY)
{
+ // Skip quiet moves if movecount exceeds our FutilityMoveCount threshold
+ moveCountPruning = depth < 16 * ONE_PLY
+ && moveCount >= FutilityMoveCounts[improving][depth / ONE_PLY];
+
if ( !captureOrPromotion
&& !givesCheck
&& !pos.advanced_pawn_push(move))
futilityBase = bestValue + 128;
}
- const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory, nullptr, (ss-4)->continuationHistory };
+ const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory,
+ nullptr, (ss-4)->continuationHistory,
+ nullptr, (ss-6)->continuationHistory };
// Initialize a MovePicker object for the current position, and prepare
// to search the moves. Because the depth is <= 0 here, only captures,
void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus) {
- for (int i : {1, 2, 4})
+ for (int i : {1, 2, 4, 6})
if (is_ok((ss-i)->currentMove))
(*(ss-i)->continuationHistory)[pc][to] << bonus;
}