mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-26 20:16:14 +08:00
Split UCI into UCIEngine and Engine
This is another refactor which aims to decouple uci from stockfish. A new engine class manages all engine related logic and uci is a "small" wrapper around it. In the future we should also try to remove the need for the Position object in the uci and replace the options with an actual options struct instead of using a map. Also convert the std::string's in the Info structs a string_view. closes #5147 No functional change
This commit is contained in:
25
src/uci.h
25
src/uci.h
@@ -22,6 +22,7 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "engine.h"
|
||||
#include "misc.h"
|
||||
#include "nnue/network.h"
|
||||
#include "position.h"
|
||||
@@ -36,9 +37,9 @@ class Move;
|
||||
enum Square : int;
|
||||
using Value = int;
|
||||
|
||||
class UCI {
|
||||
class UCIEngine {
|
||||
public:
|
||||
UCI(int argc, char** argv);
|
||||
UCIEngine(int argc, char** argv);
|
||||
|
||||
void loop();
|
||||
|
||||
@@ -47,25 +48,17 @@ class UCI {
|
||||
static std::string square(Square s);
|
||||
static std::string move(Move m, bool chess960);
|
||||
static std::string wdl(Value v, const Position& pos);
|
||||
static Move to_move(const Position& pos, std::string& str);
|
||||
static Move to_move(const Position& pos, std::string str);
|
||||
|
||||
static Search::LimitsType parse_limits(const Position& pos, std::istream& is);
|
||||
|
||||
const std::string& working_directory() const { return cli.workingDirectory; }
|
||||
|
||||
OptionsMap options;
|
||||
Eval::NNUE::Networks networks;
|
||||
|
||||
private:
|
||||
TranspositionTable tt;
|
||||
ThreadPool threads;
|
||||
CommandLine cli;
|
||||
Engine engine;
|
||||
CommandLine cli;
|
||||
|
||||
void go(Position& pos, std::istringstream& is, StateListPtr& states);
|
||||
void bench(Position& pos, std::istream& args, StateListPtr& states);
|
||||
void position(Position& pos, std::istringstream& is, StateListPtr& states);
|
||||
void trace_eval(Position& pos);
|
||||
void search_clear();
|
||||
void go(Position& pos, std::istringstream& is);
|
||||
void bench(Position& pos, std::istream& args);
|
||||
void position(std::istringstream& is);
|
||||
void setoption(std::istringstream& is);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user