mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 16:47:37 +00:00
Transform search output to engine callbacks
Part 2 of the Split UCI into UCIEngine and Engine refactor. This creates function callbacks for search to use when an update should occur. The benching in uci.cpp for example does this to extract the total nodes searched. No functional change
This commit is contained in:
@@ -21,19 +21,17 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include "engine.h"
|
||||
#include "misc.h"
|
||||
#include "nnue/network.h"
|
||||
#include "position.h"
|
||||
#include "search.h"
|
||||
#include "thread.h"
|
||||
#include "tt.h"
|
||||
#include "ucioption.h"
|
||||
|
||||
namespace Stockfish {
|
||||
|
||||
class Position;
|
||||
class Move;
|
||||
class Score;
|
||||
enum Square : int;
|
||||
using Value = int;
|
||||
|
||||
@@ -44,7 +42,7 @@ class UCIEngine {
|
||||
void loop();
|
||||
|
||||
static int to_cp(Value v, const Position& pos);
|
||||
static std::string to_score(Value v, const Position& pos);
|
||||
static std::string format_score(const Score& s);
|
||||
static std::string square(Square s);
|
||||
static std::string move(Move m, bool chess960);
|
||||
static std::string wdl(Value v, const Position& pos);
|
||||
@@ -52,6 +50,8 @@ class UCIEngine {
|
||||
|
||||
static Search::LimitsType parse_limits(const Position& pos, std::istream& is);
|
||||
|
||||
auto& engine_options() { return engine.get_options(); }
|
||||
|
||||
private:
|
||||
Engine engine;
|
||||
CommandLine cli;
|
||||
@@ -60,6 +60,11 @@ class UCIEngine {
|
||||
void bench(Position& pos, std::istream& args);
|
||||
void position(std::istringstream& is);
|
||||
void setoption(std::istringstream& is);
|
||||
|
||||
static void on_update_no_moves(const Engine::InfoShort& info);
|
||||
static void on_update_full(const Engine::InfoFull& info, bool showWDL);
|
||||
static void on_iter(const Engine::InfoIter& info);
|
||||
static void on_bestmove(std::string_view bestmove, std::string_view ponder);
|
||||
};
|
||||
|
||||
} // namespace Stockfish
|
||||
|
||||
Reference in New Issue
Block a user