From db4d104ed965592c1d89c31d96301f0a44640df7 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Thu, 3 Feb 2022 07:10:32 +0100 Subject: Integrate windows process --- src/UCI.hpp.in | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 src/UCI.hpp.in (limited to 'src/UCI.hpp.in') diff --git a/src/UCI.hpp.in b/src/UCI.hpp.in new file mode 100644 index 0000000..86925c5 --- /dev/null +++ b/src/UCI.hpp.in @@ -0,0 +1,129 @@ +#define @COMPILE_PLATFORM@ +#ifdef UNIX +#include "ProcessLinux.hpp" +#define INIT_PROCESS(p) \ + { p = static_cast(new ProcessLinux()); } +#endif +#ifdef WIN32 +#include "ProcessWindows.hpp" +#define INIT_PROCESS(p) \ + { p = static_cast(new ProcessWindows()); } +#endif +#include +#include +#include +#include +#include + +#define IS_OPT_PARAM(str) \ + ((str) == "name" || (str) == "type" | (str) == "default" || \ + (str) == "min" || (str) == "max" || (str) == "var") + +namespace uciadapter { + +/// @brief Empty string and option if not specified +typedef struct Option { + std::string name; + std::string type; + std::string default_value; + std::string min; + std::string max; + std::string var; +} Option; + +/// @brief All long are initiated to -1 if not set +class Info { +public: + long depth; + long seldepth; + long multipv; + long score_cp; + long score_mate; + long score_lowerbound; + long score_upperbound; + long cp; + long nodes; + long nps; + long tbhits; + long time; + long hashfull; + long cpuload; + long currmovenumber; + std::vector pv; + std::string currmove; + Info(); +}; + +/// @brief Calling go(Go()) will perform a Command("go"). Just leave unused +/// parameters untouched +class Go { +public: + std::string searchmoves; + std::string ponder; + int wtime, btime, winc, binc, movestogo, depth, nodes, mate, movetime; + bool infinite; + Go(); +}; + +class UCI { + Process *p; + /// @brief Reset on each call to go() + std::string buffer; + /// @brief Reset on each call to go() + std::string bestmove, ponder; + /// @brief Setup on engine startup + std::string name, author; + /// @brief Setup on engine startup + std::vector