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