Cute Chess  0.1
Public Member Functions | Protected Slots | Protected Member Functions | List of all members
XboardEngine Class Reference

A chess engine which uses the Xboard chess engine communication protocol. More...

#include <xboardengine.h>

Inheritance diagram for XboardEngine:
ChessEngine ChessPlayer QObject

Public Member Functions

virtual void endGame (const Chess::Result &result)
 
virtual void makeMove (const Chess::Move &move)
 
virtual QString protocol () const
 
 XboardEngine (QObject *parent=nullptr)
 
- Public Member Functions inherited from ChessEngine
void applyConfiguration (const EngineConfiguration &configuration)
 
 ChessEngine (QObject *parent=nullptr)
 
QIODevicedevice () const
 
virtual bool isHuman () const
 
virtual bool isReady () const
 
QList< EngineOption * > options () const
 
void ping (bool sendCommand=true)
 
void setDevice (QIODevice *device)
 
void setOption (const QString &name, const QVariant &value)
 
void start ()
 
virtual bool supportsVariant (const QString &variant) const
 
QStringList variants () const
 
void write (const QString &data, WriteMode mode=Buffered)
 
- Public Member Functions inherited from ChessPlayer
bool areClaimsValidated () const
 
 ChessPlayer (QObject *parent=nullptr)
 
virtual void clearPonderState ()
 
QString errorString () const
 
const MoveEvaluationevaluation () const
 
bool hasError () const
 
virtual void makeBookMove (const Chess::Move &move)
 
QString name () const
 
void newGame (Chess::Side side, ChessPlayer *opponent, Chess::Board *board)
 
void setCanPlayAfterTimeout (bool enable)
 
void setClaimsValidated (bool validate)
 
void setName (const QString &name)
 
void setTimeControl (const TimeControl &timeControl)
 
Chess::Side side () const
 
virtual void startPondering ()
 
State state () const
 
const TimeControltimeControl () const
 

Protected Slots

virtual void onTimeout ()
 
- Protected Slots inherited from ChessEngine
void clearWriteBuffer ()
 
void flushWriteBuffer ()
 
void onIdleTimeout ()
 
void onPingTimeout ()
 
void onProtocolStart ()
 
void onReadyRead ()
 
virtual void onTimeout ()
 
void pong (bool emitReady=true)
 
- Protected Slots inherited from ChessPlayer
virtual void onCrashed ()
 
virtual void onTimeout ()
 

Protected Member Functions

virtual void parseLine (const QString &line)
 
virtual bool restartsBetweenGames () const
 
virtual void sendOption (const QString &name, const QVariant &value)
 
virtual bool sendPing ()
 
virtual void sendQuit ()
 
virtual void sendStop ()
 
virtual void startGame ()
 
virtual void startProtocol ()
 
virtual void startThinking ()
 
- Protected Member Functions inherited from ChessEngine
void addOption (EngineOption *option)
 
void addVariant (const QString &variant)
 
void clearVariants ()
 
EngineOptiongetOption (const QString &name) const
 
virtual bool isPondering () const
 
bool pondering () const
 
EngineConfiguration::RestartMode restartMode () const
 
bool stopThinking ()
 
bool whiteEvalPov () const
 
- Protected Member Functions inherited from ChessPlayer
Chess::Boardboard ()
 
virtual bool canPlayAfterTimeout () const
 
void claimResult (const Chess::Result &result)
 
void emitMove (const Chess::Move &move)
 
void forfeit (Chess::Result::Type type, const QString &description=QString())
 
const ChessPlayeropponent () const
 
void setError (const QString &error)
 
void setState (State state)
 

Additional Inherited Members

- Public Types inherited from ChessEngine
enum  WriteMode { Buffered, Unbuffered }
 
- Public Types inherited from ChessPlayer
enum  State {
  NotStarted, Starting, Idle, Observing,
  Thinking, FinishingGame, Disconnected
}
 
- Public Slots inherited from ChessEngine
virtual void go ()
 
virtual void kill ()
 
virtual void quit ()
 
- Public Slots inherited from ChessPlayer
virtual void go ()
 
virtual void kill ()
 
virtual void quit ()
 
- Signals inherited from ChessPlayer
void debugMessage (const QString &data)
 
void disconnected ()
 
void moveMade (const Chess::Move &move)
 
void nameChanged (const QString &name)
 
void ready ()
 
void resultClaim (const Chess::Result &result)
 
void startedThinking (int timeLeft)
 
void stoppedThinking ()
 
void thinking (const MoveEvaluation &eval)
 
- Static Protected Member Functions inherited from ChessEngine
static QStringRef firstToken (const QString &str, bool readToEnd=false)
 
static QStringRef nextToken (const QStringRef &previous, bool readToEnd=false)
 
- Protected Attributes inherited from ChessPlayer
MoveEvaluation m_eval
 

Detailed Description

A chess engine which uses the Xboard chess engine communication protocol.

Xboard's specifications: http://www.open-aurec.com/wbforum/WinBoard/engine-intf.html

Constructor & Destructor Documentation

XboardEngine::XboardEngine ( QObject parent = nullptr)

Creates a new XboardEngine.

Member Function Documentation

void XboardEngine::endGame ( const Chess::Result result)
virtual

Tells the player that the game ended by result.

Note
Subclasses that reimplement this function must call the base implementation.

Reimplemented from ChessEngine.

void XboardEngine::makeMove ( const Chess::Move move)
virtual

Sends the next move of an ongoing game to the player. If the player is in force/observer mode, the move wasn't necessarily made by the opponent.

Implements ChessPlayer.

void XboardEngine::parseLine ( const QString line)
protectedvirtual

Parses a line of input from the engine.

Implements ChessEngine.

QString XboardEngine::protocol ( ) const
virtual

Returns the engine's chess protocol.

Implements ChessEngine.

bool XboardEngine::restartsBetweenGames ( ) const
protectedvirtual

Returns true if the engine restarts between games; otherwise returns false.

Reimplemented from ChessEngine.

void XboardEngine::sendOption ( const QString name,
const QVariant value 
)
protectedvirtual

Tells the engine to set option name's value to value.

Implements ChessEngine.

bool XboardEngine::sendPing ( )
protectedvirtual

Sends a ping command to the engine. Returns true if successful; otherwise returns false.

Implements ChessEngine.

void XboardEngine::sendQuit ( )
protectedvirtual

Sends the quit command to the engine.

Implements ChessEngine.

void XboardEngine::sendStop ( )
protectedvirtual

Sends the stop command to the engine.

Implements ChessEngine.

void XboardEngine::startGame ( )
protectedvirtual

Starts the chess game set up by newGame().

Implements ChessEngine.

void XboardEngine::startProtocol ( )
protectedvirtual

Puts the engine in the correct mode to start communicating with it, using the chosen chess protocol.

Implements ChessEngine.

void XboardEngine::startThinking ( )
protectedvirtual

Tells the player to start thinking of the next move.

The player is guaranteed to be ready to move when this function is called by go().

Implements ChessPlayer.


The documentation for this class was generated from the following files: