namespace Eval {
Color RootColor;
- Value ValueDrawContempt;
+ Value ContemptFactor;
+ Value ValueDraw[2];
/// evaluate() is the main evaluation function. It always computes two
/// values, an endgame score and a middle game score, and interpolates
KingDangerTable[0][i] = apply_weight(make_score(t, 0), Weights[KingDangerThem]);
}
- ValueDrawContempt = VALUE_DRAW - Options["Contempt Factor"] * PawnValueMg / 100;
+ if (Options["UCI_AnalyseMode"])
+ ContemptFactor = VALUE_ZERO;
+ else
+ ContemptFactor = Options["Contempt Factor"] * PawnValueMg / 100;
}
namespace Eval {
extern Color RootColor;
-extern Value ValueDrawContempt;
+extern Value ContemptFactor;
+extern Value ValueDraw[2];
extern void init();
extern Value evaluate(const Position& pos, Value& margin);
Position& pos = RootPosition;
Chess960 = pos.is_chess960();
Eval::RootColor = pos.side_to_move();
+ Eval::ValueDraw[ Eval::RootColor] = VALUE_DRAW - Eval::ContemptFactor;
+ Eval::ValueDraw[~Eval::RootColor] = VALUE_DRAW + Eval::ContemptFactor;
TimeMgr.init(Limits, pos.startpos_ply_counter(), pos.side_to_move());
TT.new_search();
H.clear();
{
// Step 2. Check for aborted search and immediate draw
if (Signals.stop || pos.is_draw<false>() || ss->ply > MAX_PLY)
- return Eval::ValueDrawContempt;
+ return Eval::ValueDraw[pos.side_to_move()];
// Step 3. Mate distance pruning. Even if we mate at the next move our score
// would be at best mate_in(ss->ply+1), but if alpha is already bigger because
// Check for an instant draw or maximum ply reached
if (pos.is_draw<true>() || ss->ply > MAX_PLY)
- return Eval::ValueDrawContempt;
+ return Eval::ValueDraw[pos.side_to_move()];
// Decide whether or not to include checks, this fixes also the type of
// TT entry depth that we are going to use. Note that in qsearch we use