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

implementation of user interface More...

#include <engineinterface.h>

+ Inheritance diagram for engineInterface:

Public Member Functions

 engineInterface (std::string const &s, std::string const &h="")
 Common commands to all modes this ctor is called for each iface.
 
virtual ~engineInterface ()
 
 engineInterface (engineInterface const &)=delete
 
 engineInterface (engineInterface &&)=delete
 
engineInterfaceoperator= (engineInterface const &)=delete
 
engineInterfaceoperator= (engineInterface &&)=delete
 
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)
 
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.
 
virtual void sendInfo (std::string const &info)
 
virtual void sendDebug (int const l, std::string const &info)
 
virtual void sendMove (bBoard &b, bMove const &m)
 
virtual void sendResult (bBoard const &b, gameResult_t const gr) const
 
virtual void sendInfoSearchStart (std::string const &info)
 
virtual void sendInfoDepth (int depth, int seldepth, int64_t nodes, int nps)
 
virtual void sendInfoSearching (bBoard const &b, int const nLogDepth, depth_t const nMaxDepth, bScore const sc, int64_t const t, int64_t const nodes) const
 
virtual void sendInfoSearching (bBoard const &b, int const nLogDepth, depth_t const nMaxDepth, std::string const &comment, bScore const sc, int64_t const t, int64_t const nodes) const
 
virtual void sendInfoCurrMove (bBoard const &b, depth_t const nCurDepth, bMove const &m, movenum_t const moveid, int64_t const nodes) const
 
std::string const & getHint () const
 
 operator std::string () const &
 
virtual std::string engineGameResultString (gameResult_t const gr) const
 

Static Public Member Functions

static std::string scoreAsString (bScore const score)
 

Protected Member Functions

void attachCommand (belofte::stringList const &sCommands, bool const published=true)
 
virtual std::string scoreString (bScore const score) const
 

Static Protected Member Functions

static engineCommands_tgetEngineCommands ()
 

Detailed Description

implementation of user interface

Definition at line 32 of file engineinterface.h.

Constructor & Destructor Documentation

◆ engineInterface() [1/3]

engineInterface::engineInterface ( std::string const & s,
std::string const & h = "" )
explicit

Common commands to all modes this ctor is called for each iface.

Definition at line 16 of file engineinterface.cpp.

Referenced by BelofteMode::BelofteMode(), engineInterface(), engineInterface(), operator=(), operator=(), UCIMode::UCIMode(), and XboardMode::XboardMode().

+ Here is the caller graph for this function:

◆ ~engineInterface()

engineInterface::~engineInterface ( )
virtual

Definition at line 46 of file engineinterface.cpp.

+ Here is the call graph for this function:

◆ engineInterface() [2/3]

engineInterface::engineInterface ( engineInterface const & )
delete
+ Here is the call graph for this function:

◆ engineInterface() [3/3]

engineInterface::engineInterface ( engineInterface && )
delete
+ Here is the call graph for this function:

Member Function Documentation

◆ operator=() [1/2]

engineInterface & engineInterface::operator= ( engineInterface const & )
delete
+ Here is the call graph for this function:

◆ operator=() [2/2]

engineInterface & engineInterface::operator= ( engineInterface && )
delete
+ Here is the call graph for this function:

◆ execute()

void engineInterface::execute ( std::string const & command,
std::string const & params )

Definition at line 61 of file engineinterface.cpp.

Referenced by cmd_again::execute(), cmd_option::execute(), cmd_protover::execute(), cmd_setoption::execute(), cmd_usermove::execute(), main(), 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 45 of file engineinterface.h.

Referenced by bel_debug::execute(), cmd_force::execute(), cmd_go::execute(), cmd_new::execute(), cmd_playother::execute(), sendResult(), and XboardMode::sendResult().

+ Here is the caller graph for this function:

◆ isRunning()

virtual bool engineInterface::isRunning ( ) const
inlinevirtual

Reimplemented in UCIMode.

Definition at line 47 of file engineinterface.h.

◆ sendPrompt()

virtual void engineInterface::sendPrompt ( )
inlinevirtual

Reimplemented in BelofteMode.

Definition at line 50 of file engineinterface.h.

Referenced by commandReader::runner().

+ Here is the caller graph for this function:

◆ sendResponse()

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

Definition at line 153 of file engineinterface.cpp.

Referenced by cmd_echo::execute(), cmd_isready::execute(), cmd_ping::execute(), cmd_protover::execute(), and cmd_uci::execute().

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

◆ sendInvalidMove()

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

Reimplemented in XboardMode.

Definition at line 53 of file engineinterface.h.

Referenced by cmd_position::execute(), and cmd_usermove::execute().

+ 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

◆ 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 unsupported means all plus unsupported commands hidden means all plus hidden commands

Definition at line 101 of file engineinterface.cpp.

Referenced by cmd_help::execute().

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

◆ sendInfo()

virtual void engineInterface::sendInfo ( std::string const & info)
inlinevirtual

Reimplemented in UCIMode, and XboardMode.

Definition at line 57 of file engineinterface.h.

Referenced by sendInfoSearchStart().

+ Here is the caller graph for this function:

◆ sendDebug()

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

Reimplemented in UCIMode, and XboardMode.

Definition at line 59 of file engineinterface.h.

◆ sendMove()

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

Reimplemented in UCIMode.

Definition at line 166 of file engineinterface.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 const & b,
gameResult_t const gr ) const
virtual

Reimplemented in UCIMode, and XboardMode.

Definition at line 172 of file engineinterface.cpp.

Referenced by cmd_usermove::execute(), and bGame::WaitForSearchEnd().

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

◆ sendInfoSearchStart()

void engineInterface::sendInfoSearchStart ( std::string const & info)
virtual

Definition at line 148 of file engineinterface.cpp.

+ Here is the call graph for this function:

◆ sendInfoDepth()

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

Reimplemented in UCIMode.

Definition at line 66 of file engineinterface.h.

◆ sendInfoSearching() [1/2]

virtual void engineInterface::sendInfoSearching ( bBoard const & b,
int const nLogDepth,
depth_t const nMaxDepth,
bScore const sc,
int64_t const t,
int64_t const nodes ) const
inlinevirtual

Reimplemented in UCIMode, and XboardMode.

Definition at line 69 of file engineinterface.h.

◆ sendInfoSearching() [2/2]

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

Reimplemented in UCIMode.

Definition at line 73 of file engineinterface.h.

◆ sendInfoCurrMove()

virtual void engineInterface::sendInfoCurrMove ( bBoard const & b,
depth_t const nCurDepth,
bMove const & m,
movenum_t const moveid,
int64_t const nodes ) const
inlinevirtual

Reimplemented in UCIMode.

Definition at line 77 of file engineinterface.h.

◆ getHint()

std::string const & engineInterface::getHint ( ) const
inline

Definition at line 83 of file engineinterface.h.

◆ operator std::string()

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

Definition at line 86 of file engineinterface.h.

◆ scoreAsString()

std::string engineInterface::scoreAsString ( bScore const score)
static

Definition at line 184 of file engineinterface.cpp.

Referenced by SearchAlphaBetaFH::CalcBestMove(), cmd_eval::execute(), bMove::getMoveEvalStr(), bSearchScore::operator std::string(), and scoreString().

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

◆ engineGameResultString()

std::string engineInterface::engineGameResultString ( gameResult_t const gr) const
virtual
Todo
add other end of game conditions

Reimplemented in XboardMode.

Definition at line 214 of file engineinterface.cpp.

Referenced by XboardMode::engineGameResultString(), and cmd_eval::execute().

+ Here is the caller graph for this function:

◆ attachCommand()

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

Definition at line 84 of file engineinterface.cpp.

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

+ Here is the caller graph for this function:

◆ scoreString()

virtual std::string engineInterface::scoreString ( bScore const score) const
inlineprotectedvirtual

Reimplemented in UCIMode, and XboardMode.

Definition at line 96 of file engineinterface.h.

+ Here is the call graph for this function:

◆ getEngineCommands()

static engineCommands_t & engineInterface::getEngineCommands ( )
inlinestaticprotected

Definition at line 99 of file engineinterface.h.

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

+ Here is the caller graph for this function: