+ Value value = root_search(p, ss, rml, alpha, beta);
+
+ // Write PV to transposition table, in case the relevant entries have
+ // been overwritten during the search.
+ TT.insert_pv(p, ss[0].pv);
+
+ if (AbortSearch)
+ break; // Value cannot be trusted. Break out immediately!
+
+ //Save info about search result
+ Value speculatedValue;
+ bool fHigh = false;
+ bool fLow = false;
+ Value delta = value - IterationInfo[Iteration - 1].value;
+
+ if (value >= beta)
+ {
+ assert(delta > 0);
+
+ fHigh = true;
+ speculatedValue = value + delta;
+ BestMoveChangesByIteration[Iteration] += 2; // Allocate more time
+ }
+ else if (value <= alpha)
+ {
+ assert(value == alpha);
+ assert(delta < 0);
+
+ fLow = true;
+ speculatedValue = value + delta;
+ BestMoveChangesByIteration[Iteration] += 3; // Allocate more time
+ } else
+ speculatedValue = value;
+
+ speculatedValue = Min(Max(speculatedValue, -VALUE_INFINITE), VALUE_INFINITE);
+ IterationInfo[Iteration] = IterationInfoType(value, speculatedValue);