50 std::unique_ptr<PolyglotBook>
book_;
73 std::unique_ptr<PolyglotBook>
book2_;
89 explicit UciProtocol(
const std::string &modelPath,
bool useSimpleEval =
false,
90 const std::string &tbPath =
"",
91 const std::string &bookPath =
"",
92 const std::string &bookPath2 =
"",
int evalThreads = 0);
145 void handleGo(std::istringstream &is);
168 void sendInfo(
int depth,
int score,
int nodes,
int nps,
169 const std::vector<Move> &pv,
const Board &board);
Runtime evaluator manager.
Search interface and shared data structures.
Monte Carlo Tree Search implementation.
Alpha-Beta search implementation with enhancements.
Transposition Table implementation using a 3+1 Cluster Architecture.
Syzygy tablebase probing via Fathom.
Sophisticated time allocation and management for the chess engine.
Common type definitions and constants for the chess engine.
chess::Move Move
Alias for chess::Move.
Definition Types.h:15
chess::Board Board
Alias for chess::Board.
Definition Types.h:14
static constexpr const char * ENGINE_VERSION
Definition UCI.h:31
Management of UCI engine options.
The main Transposition Table.
Definition TT.h:145
uint64_t ttSnapshotCounter_
Definition UCI.h:78
void handleIsReady()
Handles the 'isready' command (initializes lazy resources).
Definition UCI.cpp:198
uint64_t searchBaseTtHits_
Definition UCI.h:83
void handlePosition(std::istringstream &is)
Handles the 'position' command to set up the board state.
Definition UCI.cpp:232
SearchParams ponderParams_
Time params from go ponder for ponderhit use.
Definition UCI.h:65
void handleUci()
Handles the 'uci' command (sends id and options).
Definition UCI.cpp:191
void saveTTSnapshotForMove(const std::string &moveUci)
Dumps a snapshot of the Transposition Table to disk (for debugging).
Definition UCI.cpp:923
void initializeEngine()
Performs heavy lazy initialization of networks and threads.
Definition UCI.cpp:743
std::string pendingTTLoadFile_
Definition UCI.h:77
void handleEval()
Handles the custom 'eval' command to print the static evaluation of the current position.
Definition UCI.cpp:972
std::vector< std::thread > threadPool_
Definition UCI.h:53
void sendBestMove(Move move, Move ponderMove=Move(Move::NO_MOVE))
Sends the 'bestmove' UCI string to conclude a search.
Definition UCI.cpp:909
~UciProtocol()
Definition UCI.cpp:72
uint64_t searchBaseTbHits_
Definition UCI.h:82
std::atomic< bool > ponderResultReady_
Definition UCI.h:62
void handleSetOption(std::istringstream &is)
Handles the 'setoption' command to configure engine parameters.
Definition UCI.cpp:209
uint64_t searchBaseFullRebuilds_
Definition UCI.h:81
void resizeHash(size_t mb)
Resizes the transposition table memory block.
Definition UCI.cpp:991
std::atomic< bool > pondering_
Definition UCI.h:61
void updateEvalContexts()
Refreshes the thread-local evaluation contexts.
Definition UCI.cpp:1007
void setPendingTTLoadFile(const std::string &file)
Queues a saved TT snapshot file to be loaded before the next search.
Definition UCI.h:124
std::unique_ptr< ISearch > searcher_
Definition UCI.h:57
void updateThreads(int numThreads)
Restarts the search thread pool with the specified number of threads.
Definition UCI.cpp:995
std::vector< std::unique_ptr< IEvaluator > > evalCtxs_
Definition UCI.h:48
int consecutiveBookMisses_
Definition UCI.h:74
void sendInfo(int depth, int score, int nodes, int nps, const std::vector< Move > &pv, const Board &board)
Sends search progress information via 'info' UCI strings.
Definition UCI.cpp:855
std::atomic< bool > searchMayRunForever_
Definition UCI.h:60
UciProtocol(const std::string &modelPath, bool useSimpleEval=false, const std::string &tbPath="", const std::string &bookPath="", const std::string &bookPath2="", int evalThreads=0)
Constructs the UCI Protocol handler.
Definition UCI.cpp:43
std::shared_ptr< SearchSharedData > searchData_
Definition UCI.h:54
static std::string sanitizeForFilename(const std::string &value)
Sanitizes a UCI string to be safe for filesystem filenames.
Definition UCI.cpp:958
static constexpr const char * ENGINE_NAME
Definition UCI.h:43
void loop()
The main blocking loop that reads commands from standard input.
Definition UCI.cpp:80
void handleStop()
Handles the 'stop' command to halt the current search immediately.
Definition UCI.cpp:728
std::vector< std::unique_ptr< Evaluator > > evaluators_
Definition UCI.h:47
std::atomic< bool > searchRunning_
Definition UCI.h:59
static constexpr const char * ENGINE_AUTHOR
Definition UCI.h:44
std::unique_ptr< PolyglotBook > book2_
Definition UCI.h:73
void reinitEngine()
Performs a full re-initialization of the engine and evaluator state.
Definition UCI.cpp:1001
void handlePonderHit()
Handles the 'ponderhit' command (converts a ponder search to a normal search).
Definition UCI.cpp:641
Board currentBoard_
Definition UCI.h:69
void loadBooks()
Reloads the Polyglot opening books from the configured paths.
Definition UCI.cpp:1022
void handleQuit()
Handles the 'quit' command to exit the engine process.
Definition UCI.cpp:741
std::thread searchThread_
Definition UCI.h:58
static std::string formatScore(int score)
Formats an internal centipawn/mate score into a UCI-compliant string.
Definition UCI.cpp:830
void setTTDisabled(bool disable)
Disables or enables the transposition table globally.
Definition UCI.cpp:1038
void initTablebase()
Reloads the Syzygy tablebases from the configured path.
Definition UCI.cpp:1016
void handleGo(std::istringstream &is)
Handles the 'go' command to start a search with specified parameters.
Definition UCI.cpp:270
std::mutex ponderMutex_
Definition UCI.h:66
static constexpr int MAX_BOOK_MISSES
Definition UCI.h:75
UciOptions options_
Definition UCI.h:72
void handleUciNewGame()
Handles the 'ucinewgame' command (clears TT and search state).
Definition UCI.cpp:226
std::unique_ptr< PolyglotBook > book_
Definition UCI.h:50
Move ponderResultMove_
Definition UCI.h:63
Move ponderMove_
Expected opponent reply (2nd move in PV).
Definition UCI.h:64
TranspositionTable tt_
Definition UCI.h:49
Polyglot opening book parser and probe utility.
Parameters defining the constraints for a search operation.
Definition ISearch.h:125
Holds all configurable engine parameters.
Definition UciOptions.h:19