Depth extension, newDepth, predictedDepth;
Value bestValue, value, ttValue, eval, nullValue;
bool ttHit, inCheck, givesCheck, singularExtensionNode, improving;
- bool captureOrPromotion, doFullDepthSearch;
+ bool captureOrPromotion, doFullDepthSearch, moveCountPruning;
Piece moved_piece;
int moveCount, quietCount;
? ci.checkSquares[type_of(pos.piece_on(from_sq(move)))] & to_sq(move)
: pos.gives_check(move, ci);
+ moveCountPruning = depth < 16 * ONE_PLY
+ && moveCount >= FutilityMoveCounts[improving][depth];
+
// Step 12. Extend checks
- if (givesCheck && pos.see_sign(move) >= VALUE_ZERO)
+ if ( givesCheck
+ && ( moveCount == 1
+ || (!moveCountPruning && pos.see_sign(move) >= VALUE_ZERO)))
extension = ONE_PLY;
// Singular extension search. If all moves but one fail low on a search of
&& bestValue > VALUE_MATED_IN_MAX_PLY)
{
// Move count based pruning
- if ( depth < 16 * ONE_PLY
- && moveCount >= FutilityMoveCounts[improving][depth])
+ if (moveCountPruning)
continue;
// Countermoves based pruning
// Increase reduction for cut nodes
if (!PvNode && cutNode)
- r += ONE_PLY;
+ r += 2 * ONE_PLY;
// Decrease reduction for moves that escape a capture. Filter out
// castling moves, because they are coded as "king captures rook" and
else if ( type_of(move) == NORMAL
&& type_of(pos.piece_on(to_sq(move))) != PAWN
&& pos.see(make_move(to_sq(move), from_sq(move))) < VALUE_ZERO)
- r -= ONE_PLY;
+ r -= 2 * ONE_PLY;
// Decrease/increase reduction for moves with a good/bad history
int rHist = (val - 10000) / 20000;
&& !pos.captured_piece_type()
&& is_ok((ss-1)->currentMove))
{
- Value bonus = Value((depth / ONE_PLY) * (depth / ONE_PLY) + depth / ONE_PLY - 1);
+ Value bonus = Value((depth / ONE_PLY) * (depth / ONE_PLY) + 2 * depth / ONE_PLY - 2);
if ((ss-2)->counterMoves)
(ss-2)->counterMoves->update(pos.piece_on(prevSq), prevSq, bonus);
ss->killers[0] = move;
}
- Value bonus = Value((depth / ONE_PLY) * (depth / ONE_PLY) + depth / ONE_PLY - 1);
+ Value bonus = Value((depth / ONE_PLY) * (depth / ONE_PLY) + 2 * depth / ONE_PLY - 2);
Square prevSq = to_sq((ss-1)->currentMove);
CounterMoveStats* cmh = (ss-1)->counterMoves;
if ((ss-1)->moveCount == 1 && !pos.captured_piece_type())
{
if ((ss-2)->counterMoves)
- (ss-2)->counterMoves->update(pos.piece_on(prevSq), prevSq, -bonus - 2 * (depth + 1) / ONE_PLY);
+ (ss-2)->counterMoves->update(pos.piece_on(prevSq), prevSq, -bonus - 2 * (depth + 1) / ONE_PLY - 1);
if ((ss-3)->counterMoves)
- (ss-3)->counterMoves->update(pos.piece_on(prevSq), prevSq, -bonus - 2 * (depth + 1) / ONE_PLY);
+ (ss-3)->counterMoves->update(pos.piece_on(prevSq), prevSq, -bonus - 2 * (depth + 1) / ONE_PLY - 1);
if ((ss-5)->counterMoves)
- (ss-5)->counterMoves->update(pos.piece_on(prevSq), prevSq, -bonus - 2 * (depth + 1) / ONE_PLY);
+ (ss-5)->counterMoves->update(pos.piece_on(prevSq), prevSq, -bonus - 2 * (depth + 1) / ONE_PLY - 1);
}
}