- int ct = Options["Contempt"] * PawnValueEg / 100; // From centipawns
- Eval::Contempt = (us == WHITE ? make_score(ct, ct / 2)
- : -make_score(ct, ct / 2));
+ int ct = int(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));