|
BenBot 1.7.5
A chess engine
|
#include <libchess/uci/EngineBase.hpp>
Public Member Functions | |
| EngineBase ()=default | |
| EngineBase (const EngineBase &)=default | |
| EngineBase (EngineBase &&)=default | |
| virtual | ~EngineBase () |
| virtual void | abort_search () |
| virtual auto | get_author () const -> string_view=0 |
| virtual auto | get_name () const -> std::string=0 |
| virtual auto | get_options () -> std::span< Option * > |
| virtual void | go (const GoCommandOptions &opts)=0 |
| void | handle_command (string_view command) |
| virtual void | handle_custom_command (string_view command, string_view options) |
| virtual void | handle_registration (const RegisterOptions &opts) |
| virtual auto | is_searching () const noexcept -> bool=0 |
| void | loop () |
| virtual void | new_game (bool firstCall) |
| EngineBase & | operator= (const EngineBase &)=default |
| EngineBase & | operator= (EngineBase &&)=default |
| virtual void | ponder_hit () |
| virtual void | set_debug (bool shouldDebug) |
| virtual void | set_position (const Position &pos) |
| virtual void | wait () |
A base class for UCI [3] chess engines.
This class provides handling of UCI command parsing, so that the engine implementation can focus purely on implementing evaluation and search. UCI printing is provided by the functions in the uci::printing namespace.
To use this class, implement a derived class, then in your program's main() function, create an instance of your derived engine class and call its loop() method.
Definition at line 51 of file EngineBase.hpp.
|
default |
|
virtual |
|
default |
|
default |
|
inlinevirtual |
This function is called when the search should be exited.
Reimplemented in ben_bot::Engine.
Definition at line 95 of file EngineBase.hpp.
|
nodiscardpure virtual |
This must return the name of the engine's author.
Implemented in ben_bot::Engine.
|
nodiscardpure virtual |
This must return the name of the engine. The returned string may optionally contain the engine's current version, such as BenBot 1.2.0.
Implemented in ben_bot::Engine.
|
inlinenodiscardvirtual |
This must return the list of all options the engine supports.
Reimplemented in ben_bot::Engine.
Definition at line 71 of file EngineBase.hpp.
|
pure virtual |
Called when the "go" command is received. The engine should begin searching. After this function has been called, the engine should print to stdout a line of the form "bestmove <from><to>".
| void chess::uci::EngineBase::handle_command | ( | string_view | command | ) |
|
inlinevirtual |
Any command input string not recognized as a standard UCI command will invoke this function. Engines can implement custom commands by overriding this function. The "command" argument will be the first word of the input command line.
Reimplemented in ben_bot::Engine.
Definition at line 127 of file EngineBase.hpp.
|
inlinevirtual |
Called when the user send a "register" command. The engine may simply do nothing if it does not require registration.
Definition at line 142 of file EngineBase.hpp.
|
nodiscardpure virtualnoexcept |
This function must return true if a search is currently in progress. This function should be thread-safe.
Implemented in ben_bot::Engine.
| void chess::uci::EngineBase::loop | ( | ) |
Runs the engine's event loop. This function blocks while reading from stdin. The calling thread becomes the engine's "main thread".
|
inlinevirtual |
This function will be called when the "ucinewgame" command is received. This should flush any game-specific data structures such as hash tables, transposition table, etc. wait() will be called after this, before the next search begins.
| firstCall | True if this is the first time new_game() has been called. |
Reimplemented in ben_bot::Engine.
Definition at line 92 of file EngineBase.hpp.
|
default |
|
default |
|
inlinevirtual |
This function is called when the "ponderhit" command is received. This means that the engine was told to ponder on the same move the user has played. The engine should continue searching but switch from pondering to normal search.
Reimplemented in ben_bot::Engine.
Definition at line 101 of file EngineBase.hpp.
|
inlinevirtual |
Called when the "debug" command is received.
Reimplemented in ben_bot::Engine.
Definition at line 113 of file EngineBase.hpp.
|
inlinevirtual |
Called when a new position is received from the GUI.
Reimplemented in ben_bot::Engine.
Definition at line 104 of file EngineBase.hpp.
|
inlinevirtual |
This function will be called when the "isready" command is received, and may block while waiting for background tasks to complete. This function should be thread-safe.
Reimplemented in ben_bot::Engine.
Definition at line 77 of file EngineBase.hpp.