+ //The IterationInfoType is used to store search history
+ //iteration by iteration.
+ //
+ //Because we use relatively small (dynamic) aspiration window,
+ //there happens many fail highs and fail lows in root. And
+ //because we don't do researches in those cases, "value" stored
+ //here is not necessarily exact. Instead in case of fail high/low
+ //we guess what the right value might be and store our guess
+ //as "speculated value" and then move on...
+
+ class IterationInfoType {
+ private:
+ Value _value;
+ Value _speculatedValue;
+ bool _failHigh;
+ bool _failLow;
+ public:
+ IterationInfoType() {
+ clear();
+ }
+
+ inline void clear() {
+ set(Value(0));
+ }
+
+ inline void set(Value v) {
+ set(v, v, false, false);
+ }
+
+ inline void set(Value v, Value specV, bool fHigh, bool fLow) {
+ _value = v;
+ _speculatedValue = specV;
+ _failHigh = fHigh;
+ _failLow = fLow;
+ }
+
+ inline Value value() {
+ return _value;
+ }
+
+ inline Value speculated_value() {
+ return _speculatedValue;
+ }
+
+ inline bool fail_high() {
+ return _failHigh;
+ }
+
+ inline bool fail_low() {
+ return _failLow;
+ }
+ };
+
+
+ // The BetaCounterType class is used to order moves at ply one.
+ // Apart for the first one that has its score, following moves
+ // normally have score -VALUE_INFINITE, so are ordered according
+ // to the number of beta cutoffs occurred under their subtree during
+ // the last iteration.
+
+ struct BetaCounterType {
+
+ BetaCounterType();
+ void clear();
+ void add(Color us, Depth d, int threadID);
+ void read(Color us, int64_t& our, int64_t& their);
+
+ int64_t hits[THREAD_MAX][2];
+ };
+
+