multiPV = std::min(multiPV, rootMoves.size());
int ct = Options["Contempt"] * PawnValueEg / 100; // From centipawns
+
+ // In analysis mode, adjust contempt in accordance with user preference
+ if (Limits.infinite || Options["UCI_AnalyseMode"])
+ ct = Options["Analysis Contempt"] == "Off" ? 0
+ : Options["Analysis Contempt"] == "Both" ? ct
+ : Options["Analysis Contempt"] == "White" && us == BLACK ? -ct
+ : Options["Analysis Contempt"] == "Black" && us == WHITE ? -ct
+ : ct;
+
+ // In evaluate.cpp the evaluation is from the white point of view
contempt = (us == WHITE ? make_score(ct, ct / 2)
: -make_score(ct, ct / 2));
alpha = std::max(previousScore - delta,-VALUE_INFINITE);
beta = std::min(previousScore + delta, VALUE_INFINITE);
- ct = Options["Contempt"] * PawnValueEg / 100; // From centipawns
-
// Adjust contempt based on root move's previousScore (dynamic contempt)
- ct += int(std::round(48 * atan(float(previousScore) / 128)));
+ int dct = ct + int(std::round(48 * atan(float(previousScore) / 128)));
- contempt = (us == WHITE ? make_score(ct, ct / 2)
- : -make_score(ct, ct / 2));
+ contempt = (us == WHITE ? make_score(dct, dct / 2)
+ : -make_score(dct, dct / 2));
}
// Start with a small aspiration window and, in the case of a fail
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);
else
{
assert(value >= beta); // Fail high
+ ss->statScore = std::max(ss->statScore, 0);
break;
}
}