Belofte  version 2.1.5
A promising chess program using the UCI or Winboard interface
engineInterface Class Reference

implementation of user interface More...

Public Member Functions

 engineInterface (std::string const &n)
 Common commands to all modes. More...
 
virtual ~engineInterface ()
 
 engineInterface (engineInterface const &)=delete
 
 engineInterface (engineInterface &&)=delete
 
engineInterfaceoperator= (engineInterface const &)=delete
 
engineInterfaceoperator= (engineInterface &&)=delete
 
 operator std::string () const
 
void execute (std::string const &command, std::string const &params)
 
virtual void setRunning (bool const r)
 
virtual bool isRunning () const
 
virtual void sendPrompt ()
 
virtual void sendResponse (std::string const &response)
 
virtual void sendInvalidMove (std::string const &info, std::string const &reason UNUSED)
 
virtual void sendError (std::string const &error, std::string const &description)
 
virtual void sendHelp (std::string const &args)
 Send help on command or all commands. More...
 
virtual void sendDebug (int const l, std::string const &info)
 
virtual void sendMove (bBoard const &b, bMove const &m)
 
virtual void sendResult (bBoard &b, gameResult_t rs) const
 
virtual void sendInfoDepth (depth_t depth UNUSED, depth_t seldepth UNUSED, int64_t nodes UNUSED, int nps UNUSED)
 
virtual void sendInfoScore (long long timems UNUSED, bBoard const &b UNUSED, bScore const cp UNUSED)
 
virtual void sendInfoSearching (bBoard const &b UNUSED, depth_t const nLogDepth UNUSED, depth_t const nMaxDepth UNUSED, std::string const &comment UNUSED, bScore const sc UNUSED, int64_t const timems UNUSED, int64_t const nodes UNUSED) const
 
virtual void sendInfoCurrMove (bBoard const &b UNUSED, depth_t const nLogDepth UNUSED, depth_t const nMaxDepth UNUSED, std::string const &comment UNUSED, bMove const &m UNUSED, movenum_t const moveid UNUSED, int64_t const nodes UNUSED) const
 

Static Public Attributes

static engineCommands_t m_engineCommands = decltype(engineInterface::m_engineCommands){}
 

Protected Member Functions

void attachCommand (belofte::stringList const &sCommands, bool const published=true)
 

Detailed Description

implementation of user interface

Definition at line 168 of file belofte.h.

Constructor & Destructor Documentation

◆ engineInterface() [1/3]

engineInterface::engineInterface ( std::string const &  n)
explicit

Common commands to all modes.

Definition at line 308 of file belofte.cpp.

+ Here is the call graph for this function:

◆ ~engineInterface()

engineInterface::~engineInterface ( )
virtual

Definition at line 347 of file belofte.cpp.

◆ engineInterface() [2/3]

engineInterface::engineInterface ( engineInterface const &  )
delete

◆ engineInterface() [3/3]

engineInterface::engineInterface ( engineInterface &&  )
delete

Member Function Documentation

◆ operator=() [1/2]

engineInterface& engineInterface::operator= ( engineInterface const &  )
delete

◆ operator=() [2/2]

engineInterface& engineInterface::operator= ( engineInterface &&  )
delete

◆ operator std::string()

engineInterface::operator std::string ( ) const
inline

Definition at line 179 of file belofte.h.

◆ execute()

void engineInterface::execute ( std::string const &  command,
std::string const &  params 
)
Remarks
this should only apply in case of playother=0, but some UIs do not handle this correctly

Definition at line 147 of file belofte.cpp.

Referenced by main(), bGame::playUIsuppliedMove(), and commandReader::runner().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRunning()

virtual void engineInterface::setRunning ( bool const  r)
inlinevirtual

Definition at line 183 of file belofte.h.

Referenced by sendResult().

+ Here is the caller graph for this function:

◆ isRunning()

virtual bool engineInterface::isRunning ( ) const
inlinevirtual

Reimplemented in UCIMode.

Definition at line 184 of file belofte.h.

◆ sendPrompt()

void engineInterface::sendPrompt ( )
virtual

Reimplemented in XboardMode, and UCIMode.

Definition at line 253 of file usercmd.cpp.

Referenced by commandReader::runner().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendResponse()

void engineInterface::sendResponse ( std::string const &  response)
virtual

Definition at line 129 of file usercmd.cpp.

+ Here is the call graph for this function:

◆ sendInvalidMove()

virtual void engineInterface::sendInvalidMove ( std::string const &  info,
std::string const &reason  UNUSED 
)
inlinevirtual

Definition at line 188 of file belofte.h.

Referenced by bGame::playUIsuppliedMove().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendError()

void engineInterface::sendError ( std::string const &  error,
std::string const &  description 
)
virtual

Definition at line 134 of file usercmd.cpp.

Referenced by bel_debug::execute(), engineUserCommand::execute(), execute(), bSearchAlgorithm::SearchBestMove(), sendInvalidMove(), and bGame::WaitForSearchEnd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendHelp()

void engineInterface::sendHelp ( std::string const &  args)
virtual

Send help on command or all commands.

Parameters
args–all means all commands, "" or a single command TODO: implement hidden command flag

Definition at line 91 of file usercmd.cpp.

Referenced by cmd_help::execute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendDebug()

void engineInterface::sendDebug ( int const  l,
std::string const &  info 
)
virtual

Reimplemented in UCIMode.

Definition at line 142 of file usercmd.cpp.

Referenced by bSearchAlgorithm::dumpMoveList(), and bSearchAlgorithm::SearchBestMove().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendMove()

void engineInterface::sendMove ( bBoard const &  b,
bMove const &  m 
)
virtual

Reimplemented in UCIMode.

Definition at line 258 of file usercmd.cpp.

Referenced by bGame::WaitForSearchEnd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendResult()

void engineInterface::sendResult ( bBoard b,
gameResult_t  rs 
) const
virtual

Definition at line 263 of file usercmd.cpp.

Referenced by bGame::playUIsuppliedMove(), and bGame::WaitForSearchEnd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendInfoDepth()

virtual void engineInterface::sendInfoDepth ( depth_t depth  UNUSED,
depth_t seldepth  UNUSED,
int64_t nodes  UNUSED,
int nps  UNUSED 
)
inlinevirtual

Reimplemented in UCIMode.

Definition at line 198 of file belofte.h.

◆ sendInfoScore()

virtual void engineInterface::sendInfoScore ( long long timems  UNUSED,
bBoard const &b  UNUSED,
bScore const cp  UNUSED 
)
inlinevirtual

Definition at line 200 of file belofte.h.

Referenced by bSearchAlgorithm::sendInfoScore().

+ Here is the caller graph for this function:

◆ sendInfoSearching()

virtual void engineInterface::sendInfoSearching ( bBoard const &b  UNUSED,
depth_t const nLogDepth  UNUSED,
depth_t const nMaxDepth  UNUSED,
std::string const &comment  UNUSED,
bScore const sc  UNUSED,
int64_t const timems  UNUSED,
int64_t const nodes  UNUSED 
) const
inlinevirtual

Definition at line 202 of file belofte.h.

Referenced by bSearchAlgorithm::sendInfoSearching().

+ Here is the caller graph for this function:

◆ sendInfoCurrMove()

virtual void engineInterface::sendInfoCurrMove ( bBoard const &b  UNUSED,
depth_t const nLogDepth  UNUSED,
depth_t const nMaxDepth  UNUSED,
std::string const &comment  UNUSED,
bMove const &m  UNUSED,
movenum_t const moveid  UNUSED,
int64_t const nodes  UNUSED 
) const
inlinevirtual

Definition at line 205 of file belofte.h.

Referenced by bSearchAlgorithm::handleInfoCurrMove().

+ Here is the caller graph for this function:

◆ attachCommand()

void engineInterface::attachCommand ( belofte::stringList const &  sCommands,
bool const  published = true 
)
protected
Bug:
if not published, add command to list anyway

Definition at line 177 of file belofte.cpp.

Referenced by engineInterface(), UCIMode::UCIMode(), and XboardMode::XboardMode().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_engineCommands

engineCommands_t engineInterface::m_engineCommands = decltype(engineInterface::m_engineCommands){}
static

Definition at line 222 of file belofte.h.

Referenced by execute(), sendHelp(), and ~engineInterface().