stellar

UCI Chess engine written in C++20
git clone git://git.dimitrijedobrota.com/stellar.git
Log | Files | Refs | README | LICENSE |

engine.hpp (767B)


1 #ifndef STELLAR_ARENA_ENGINE_H 2 #define STELLAR_ARENA_ENGINE_H 3 4 #include <queue> 5 6 class Engine { 7 public: 8 Engine(const Engine &) = delete; 9 Engine &operator=(const Engine &) = delete; 10 Engine(const char *file); 11 12 ~Engine(); 13 14 const std::string &get_name(void) const { return name; } 15 const std::string &get_author(void) const { return author; } 16 17 void send(std::string &&command); 18 std::string receive(void); 19 20 private: 21 [[noreturn]] void start_engine(void); 22 23 const char *file = nullptr; 24 int fd_to[2], fd_from[2]; 25 pid_t engine_pid; 26 27 std::string name, author; 28 29 char rb[1000]; 30 int rb_size = 0; 31 32 std::queue<std::string> q; 33 std::string q_buffer; 34 35 static uint16_t id_t; 36 uint16_t id = id_t++; 37 }; 38 39 #endif