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

A chess engine which uses the UCI chess interface. More...

#include <uciengine.h>

Inheritance diagram for UciEngine:
ChessEngine ChessPlayer QObject

Public Member Functions

virtual void clearPonderState ()
 
virtual void endGame (const Chess::Result &result)
 
virtual void makeBookMove (const Chess::Move &move)
 
virtual void makeMove (const Chess::Move &move)
 
virtual QString protocol () const
 
virtual void startPondering ()
 
 UciEngine (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)
 
QString errorString () const
 
const MoveEvaluationevaluation () const
 
bool hasError () const
 
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
 
State state () const
 
const TimeControltimeControl () const
 

Protected Member Functions

virtual bool isPondering () const
 
virtual void parseLine (const QString &line)
 
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
 
bool pondering () const
 
EngineConfiguration::RestartMode restartMode () const
 
virtual bool restartsBetweenGames () 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)
 
- 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 ()
 
- 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 UCI chess interface.

UCI's specifications: http://wbec-ridderkerk.nl/html/UCIProtocol.html

Constructor & Destructor Documentation

UciEngine::UciEngine ( QObject parent = nullptr)

Creates a new UciEngine.

Member Function Documentation

void UciEngine::clearPonderState ( )
virtual

Clears the player's pondering state.

Reimplemented from ChessPlayer.

void UciEngine::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.

bool UciEngine::isPondering ( ) const
protectedvirtual

Returns true if the engine is currently thinking on the opponent's move; otherwise returns false.

Reimplemented from ChessEngine.

void UciEngine::makeBookMove ( const Chess::Move move)
virtual

Forces the player to play move as its next move.

Reimplemented from ChessPlayer.

void UciEngine::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 UciEngine::parseLine ( const QString line)
protectedvirtual

Parses a line of input from the engine.

Implements ChessEngine.

QString UciEngine::protocol ( ) const
virtual

Returns the engine's chess protocol.

Implements ChessEngine.

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

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

Implements ChessEngine.

bool UciEngine::sendPing ( )
protectedvirtual

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

Implements ChessEngine.

void UciEngine::sendQuit ( )
protectedvirtual

Sends the quit command to the engine.

Implements ChessEngine.

void UciEngine::sendStop ( )
protectedvirtual

Sends the stop command to the engine.

Implements ChessEngine.

void UciEngine::startGame ( )
protectedvirtual

Starts the chess game set up by newGame().

Implements ChessEngine.

void UciEngine::startPondering ( )
virtual

Tells the player to start pondering (thinking on the opponent's move). The default implementation does nothing.

Reimplemented from ChessPlayer.

void UciEngine::startProtocol ( )
protectedvirtual

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

Implements ChessEngine.

void UciEngine::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: