// Stop the search if only one legal move is available, or if all
// of the available time has been used, or if we matched an easyMove
// from the previous search and just did a fast verification.
- const bool F[] = { !mainThread->failedLow,
- bestValue >= mainThread->previousScore };
+ const int F[] = { mainThread->failedLow,
+ bestValue - mainThread->previousScore };
- int improvingFactor = 640 - 160*F[0] - 126*F[1] - 124*F[0]*F[1];
+ int improvingFactor = std::max(229, std::min(715, 357 + 119 * F[0] - 6 * F[1]));
double unstablePvFactor = 1 + mainThread->bestMoveChanges;
bool doEasyMove = rootMoves[0].pv[0] == easyMove
&& mainThread->bestMoveChanges < 0.03
- && Time.elapsed() > Time.optimum() * 25 / 204;
+ && Time.elapsed() > Time.optimum() * 5 / 42;
if ( rootMoves.size() == 1
- || Time.elapsed() > Time.optimum() * unstablePvFactor * improvingFactor / 634
+ || Time.elapsed() > Time.optimum() * unstablePvFactor * improvingFactor / 628
|| (mainThread->easyMovePlayed = doEasyMove))
{
// If we are allowed to ponder do not stop the search now but
Key posKey;
Move ttMove, move, excludedMove, bestMove;
Depth extension, newDepth, predictedDepth;
- Value bestValue, value, ttValue, eval, nullValue, futilityValue;
+ Value bestValue, value, ttValue, eval, nullValue;
bool ttHit, inCheck, givesCheck, singularExtensionNode, improving;
bool captureOrPromotion, doFullDepthSearch;
Piece moved_piece;
predictedDepth = std::max(newDepth - reduction<PvNode>(improving, depth, moveCount), DEPTH_ZERO);
// Futility pruning: parent node
- if (predictedDepth < 7 * ONE_PLY)
- {
- futilityValue = ss->staticEval + futility_margin(predictedDepth) + 256;
-
- if (futilityValue <= alpha)
- {
- bestValue = std::max(bestValue, futilityValue);
- continue;
- }
- }
+ if ( predictedDepth < 7 * ONE_PLY
+ && ss->staticEval + futility_margin(predictedDepth) + 256 <= alpha)
+ continue;
// Prune moves with negative SEE at low depths
if (predictedDepth < 4 * ONE_PLY && pos.see_sign(move) < VALUE_ZERO)
if (!PvNode && cutNode)
r += ONE_PLY;
- // Decrease/increase reduction for moves with a good/bad history
- int rHist = (val - 10000) / 20000;
- r = std::max(DEPTH_ZERO, r - rHist * ONE_PLY);
-
// Decrease reduction for moves that escape a capture. Filter out
// castling moves, because they are coded as "king captures rook" and
// hence break make_move(). Also use see() instead of see_sign(),
// because the destination square is empty.
- if ( r
- && 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 = std::max(DEPTH_ZERO, r - ONE_PLY);
+ 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;
+
+ // Decrease/increase reduction for moves with a good/bad history
+ int rHist = (val - 10000) / 20000;
+ r = std::max(DEPTH_ZERO, r - rHist * ONE_PLY);
Depth d = std::max(newDepth - r, ONE_PLY);