X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.h;h=2a9a37370af7b713bc730ece27ed47ae1de066c7;hp=5ba95fe098a5fef94ae7b7418da376fd82d0f619;hb=69240a982d8c3a2d01fab04c284be43853ab2bc9;hpb=a2410227cc8df5373d6970bfe63bbd3df5287c8c diff --git a/src/search.h b/src/search.h index 5ba95fe0..2a9a3737 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,7 +36,6 @@ namespace Search { /// its own array of Stack objects, indexed by the current ply. struct Stack { - SplitPoint* splitPoint; Move* pv; int ply; Move currentMove; @@ -58,7 +56,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); @@ -88,27 +86,25 @@ struct LimitsType { std::vector searchmoves; int time[COLOR_NB], inc[COLOR_NB], npmsec, movestogo, depth, movetime, mate, infinite, ponder; int64_t nodes; + 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 RootMoveVector RootMoves; -extern Position RootPos; extern StateStackPtr SetupStates; void init(); -void think(); -void reset(); -template uint64_t perft(Position& pos, Depth depth); +void clear(); +template uint64_t perft(Position& pos, Depth depth); } // namespace Search