Move ttMove, move, excludedMove, bestMove;
Depth extension, newDepth;
Value bestValue, value, ttValue, eval, maxValue;
- bool ttHit, inCheck, givesCheck, singularExtensionNode, improving;
+ bool ttHit, inCheck, givesCheck, improving;
bool captureOrPromotion, doFullDepthSearch, moveCountPruning, skipQuiets, ttCapture, pvExact;
Piece movedPiece;
int moveCount, captureCount, quietCount;
MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, &thisThread->captureHistory, contHist, countermove, ss->killers);
value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc
- singularExtensionNode = !rootNode
- && depth >= 8 * ONE_PLY
- && ttMove != MOVE_NONE
- && ttValue != VALUE_NONE
- && !excludedMove // Recursive singular search is not allowed
- && (tte->bound() & BOUND_LOWER)
- && tte->depth() >= depth - 3 * ONE_PLY;
skipQuiets = false;
ttCapture = false;
pvExact = PvNode && ttHit && tte->bound() == BOUND_EXACT;
// Step 13. Extensions (~70 Elo)
- // Singular extension search (~60 Elo). If all moves but one fail low on a search
- // of (alpha-s, beta-s), and just one fails high on (alpha, beta), then
- // that move is singular and should be extended. To verify this we do a
- // reduced search on on all the other moves but the ttMove and if the
+ // Singular extension search (~60 Elo). If all moves but one fail low on a
+ // search of (alpha-s, beta-s), and just one fails high on (alpha, beta),
+ // then that move is singular and should be extended. To verify this we do
+ // a reduced search on on all the other moves but the ttMove and if the
// result is lower than ttValue minus a margin then we will extend the ttMove.
- if ( singularExtensionNode
+ if ( depth >= 8 * ONE_PLY
&& move == ttMove
+ && !rootNode
+ && !excludedMove // Recursive singular search is not allowed
+ && ttValue != VALUE_NONE
+ && (tte->bound() & BOUND_LOWER)
+ && tte->depth() >= depth - 3 * ONE_PLY
&& pos.legal(move))
{
Value rBeta = std::max(ttValue - 2 * depth / ONE_PLY, -VALUE_MATE);
};
-/// Score enum stores a middlegame and an endgame value in a single integer
-/// (enum). The least significant 16 bits are used to store the endgame value
-/// and the upper 16 bits are used to store the middlegame value. Take some
-/// care to avoid left-shifting a signed int to avoid undefined behavior.
+/// Score enum stores a middlegame and an endgame value in a single integer (enum).
+/// The least significant 16 bits are used to store the middlegame value and the
+/// upper 16 bits are used to store the endgame value. We have to take care to
+/// avoid left-shifting a signed int to avoid undefined behavior.
enum Score : int { SCORE_ZERO };
constexpr Score make_score(int mg, int eg) {