X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.h;h=f93c53a50a0f4e276966b0da894d3c873574296e;hp=c7abb9dcfd97a2b5b47b87f798fc4e5718cd2bb7;hb=ed72a1e9ba37a9fa2674da8f46bb0597a1721c2d;hpb=ecc5ff6693f116f4a8ae5f5080252f29b279c0a1 diff --git a/src/search.h b/src/search.h index c7abb9dc..f93c53a5 100644 --- a/src/search.h +++ b/src/search.h @@ -20,7 +20,8 @@ #ifndef SEARCH_H_INCLUDED #define SEARCH_H_INCLUDED -#include // For std::auto_ptr +#include +#include // For std::unique_ptr #include #include @@ -28,8 +29,6 @@ #include "position.h" #include "types.h" -struct SplitPoint; - namespace Search { /// Stack struct keeps track of the information we need to remember from nodes @@ -37,11 +36,9 @@ namespace Search { /// its own array of Stack objects, indexed by the current ply. struct Stack { - SplitPoint* splitPoint; Move* pv; int ply; Move currentMove; - Move ttMove; Move excludedMove; Move killers[2]; Depth reduction; @@ -58,7 +55,7 @@ struct RootMove { explicit RootMove(Move m) : pv(1, m) {} - bool operator<(const RootMove& m) const { return score > m.score; } // Ascending sort + bool operator<(const RootMove& m) const { return m.score < score; } // Descending sort bool operator==(const Move& m) const { return pv[0] == m; } void insert_pv_in_tt(Position& pos); bool extract_ponder_from_tt(Position& pos); @@ -91,22 +88,22 @@ struct LimitsType { TimePoint startTime; }; -/// The SignalsType struct stores volatile flags updated during the search +/// The SignalsType struct stores atomic flags updated during the search /// typically in an async fashion e.g. to stop the search by the GUI. struct SignalsType { - bool stop, stopOnPonderhit, firstRootMove, failedLowAtRoot; + std::atomic_bool stop, stopOnPonderhit; }; typedef std::unique_ptr> StateStackPtr; -extern volatile SignalsType Signals; +extern SignalsType Signals; extern LimitsType Limits; extern StateStackPtr SetupStates; void init(); -void reset(); -template uint64_t perft(Position& pos, Depth depth); +void clear(); +template uint64_t perft(Position& pos, Depth depth); } // namespace Search