// 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