mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 13:17:44 +00:00
Fix Contempt Factor implementation
First disable Contempt Factor during analysis, then calculate the modified draw score from the point of view of the player, so from the point of view of RootPosition color. Thanks to Ryan Taker for suggesting the fixes. No functional change.
This commit is contained in:
+4
-2
@@ -199,6 +199,8 @@ void Search::think() {
|
||||
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();
|
||||
@@ -538,7 +540,7 @@ namespace {
|
||||
{
|
||||
// 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
|
||||
@@ -1094,7 +1096,7 @@ split_point_start: // At split points actual search starts from here
|
||||
|
||||
// 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
|
||||
|
||||
Reference in New Issue
Block a user