complexityAverage.set(155, 1);
- trend = SCORE_ZERO;
optimism[us] = optimism[~us] = VALUE_ZERO;
int searchAgainCounter = 0;
alpha = std::max(prev - delta,-VALUE_INFINITE);
beta = std::min(prev + delta, VALUE_INFINITE);
- // Adjust trend and optimism based on root move's previousScore
- int tr = 116 * prev / (std::abs(prev) + 89);
- trend = (us == WHITE ? make_score(tr, tr / 2)
- : -make_score(tr, tr / 2));
-
+ // Adjust optimism based on root move's previousScore
int opt = 118 * prev / (std::abs(prev) + 169);
optimism[ us] = Value(opt);
optimism[~us] = -optimism[us];
// Do full depth search when reduced LMR search fails high
if (value > alpha && d < newDepth)
{
+ // Adjust full depth search based on LMR results - if result
+ // was good enough search deeper, if it was bad enough search shallower
const bool doDeeperSearch = value > (alpha + 64 + 11 * (newDepth - d));
- value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth + doDeeperSearch, !cutNode);
+ const bool doShallowerSearch = value < bestValue + newDepth;
+ value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth + doDeeperSearch - doShallowerSearch, !cutNode);
int bonus = value > alpha ? stat_bonus(newDepth)
: -stat_bonus(newDepth);
}
}
}
- else
- ss->cutoffCnt = 0;
// If the move is worse than some previously searched move, remember it to update its stats later