- value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth + doDeeperSearch, !cutNode);
+ const bool doEvenDeeperSearch = value > alpha + 582;
+ const bool doShallowerSearch = value < bestValue + newDepth;
+
+ newDepth += doDeeperSearch - doShallowerSearch + doEvenDeeperSearch;
+
+ if (newDepth > d)
+ value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth, !cutNode);