A chess player, human or AI.
More...
#include <chessplayer.h>
|
| virtual void | go () |
| |
| virtual void | kill () |
| |
| virtual void | quit () |
| |
A chess player, human or AI.
- See also
- ChessEngine
The different states of ChessPlayer.
| Enumerator |
|---|
| NotStarted |
Not started or uninitialized.
|
| Starting |
Starting or initializing.
|
| Idle |
Idle and ready to start a game.
|
| Observing |
Observing a game, or waiting for turn.
|
| Thinking |
Thinking of the next move.
|
| FinishingGame |
Finishing or cleaning up after a game.
|
| Disconnected |
Disconnected or terminated.
|
| ChessPlayer::ChessPlayer |
( |
QObject * |
parent = nullptr | ) |
|
| bool ChessPlayer::areClaimsValidated |
( |
| ) |
const |
Returns true if result claims from the engine are validated; otherwise returns false.
With validation on (the default) the engine will forfeit the game if it makes an incorrect result claim.
Returns the chessboard on which the player is playing.
| bool ChessPlayer::canPlayAfterTimeout |
( |
| ) |
const |
|
protectedvirtual |
Returns true if this player can keep playing after running out of time; otherwise returns false.
| void ChessPlayer::clearPonderState |
( |
| ) |
|
|
virtual |
Clears the player's pondering state.
Reimplemented in UciEngine.
| void ChessPlayer::debugMessage |
( |
const QString & |
data | ) |
|
|
signal |
Signals a debugging message from the player.
| void ChessPlayer::disconnected |
( |
| ) |
|
|
signal |
This signal is emitted when the player disconnects.
Emits the player's move, and a timeout signal if the move came too late.
| QString ChessPlayer::errorString |
( |
| ) |
const |
Returns a detailed description of the error.
Returns the player's evaluation of the current position.
Emits the resultClaim() signal with a result of type type, description description, and this player as the loser.
Waits (without blocking) until the player is ready, starts the chess clock, and tells the player to start thinking of the next move.
- Note
- Subclasses that reimplement this function must call the base implementation.
| bool ChessPlayer::hasError |
( |
| ) |
const |
Returns true if a parsing error occured.
| virtual bool ChessPlayer::isHuman |
( |
| ) |
const |
|
pure virtual |
| bool ChessPlayer::isReady |
( |
| ) |
const |
|
virtual |
Returns true if the player is ready for input.
- Note
- When the player's state is Disconnected, this function still returns true if all the cleanup following the disconnection is done.
Reimplemented in ChessEngine.
| void ChessPlayer::kill |
( |
| ) |
|
|
virtualslot |
Kills the player process or connection, causing it to exit immediately.
The player's state is set to Disconnected.
- Note
- Subclasses that reimplement this function must call the base implementation.
| void ChessPlayer::makeBookMove |
( |
const Chess::Move & |
move | ) |
|
|
virtual |
Forces the player to play move as its next move.
Reimplemented in UciEngine.
| virtual void ChessPlayer::makeMove |
( |
const Chess::Move & |
move | ) |
|
|
pure 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.
Implemented in HumanPlayer, UciEngine, and XboardEngine.
Signals the player's move.
| QString ChessPlayer::name |
( |
| ) |
const |
Returns the player's name.
| void ChessPlayer::nameChanged |
( |
const QString & |
name | ) |
|
|
signal |
Emitted when player's name is changed.
Prepares the player for a new chess game, and then calls startGame() to start the game.
- Parameters
-
| side | The side (color) the player should play as. It can be NoSide if the player is in force/observer mode. |
| opponent | The opposing player. |
| board | The chessboard on which the game is played. |
- See also
- startGame()
| void ChessPlayer::onCrashed |
( |
| ) |
|
|
protectedvirtualslot |
Called when the player's process or connection crashes unexpectedly.
Forfeits the game.
| void ChessPlayer::onTimeout |
( |
| ) |
|
|
protectedvirtualslot |
Called when the player's flag falls. Forfeits the game.
Returns the opposing player.
| void ChessPlayer::quit |
( |
| ) |
|
|
virtualslot |
Terminates the player non-violently.
| void ChessPlayer::ready |
( |
| ) |
|
|
signal |
Signals that the player is ready for input.
Emitted when the player claims the game to end with result result.
| void ChessPlayer::setCanPlayAfterTimeout |
( |
bool |
enable | ) |
|
If enable is true the player will be allowed to continue the game after time is out, else the player will forfeit.
| void ChessPlayer::setClaimsValidated |
( |
bool |
validate | ) |
|
Sets result claim validation mode to validate.
| void ChessPlayer::setError |
( |
const QString & |
error | ) |
|
|
protected |
Sets the current error to error.
| void ChessPlayer::setName |
( |
const QString & |
name | ) |
|
| void ChessPlayer::setState |
( |
State |
state | ) |
|
|
protected |
Sets the player's state to state.
| void ChessPlayer::setTimeControl |
( |
const TimeControl & |
timeControl | ) |
|
Sets the time control for the player.
Returns the side of the player.
| void ChessPlayer::startedThinking |
( |
int |
timeLeft | ) |
|
|
signal |
Signals the time left in the player's clock when they start thinking of their next move.
- Parameters
-
| timeLeft | Time left in milliseconds. |
| virtual void ChessPlayer::startGame |
( |
| ) |
|
|
protectedpure virtual |
| void ChessPlayer::startPondering |
( |
| ) |
|
|
virtual |
Tells the player to start pondering (thinking on the opponent's move). The default implementation does nothing.
Reimplemented in UciEngine.
| virtual void ChessPlayer::startThinking |
( |
| ) |
|
|
protectedpure virtual |
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().
Implemented in HumanPlayer, UciEngine, and XboardEngine.
Returns the player's state.
| void ChessPlayer::stoppedThinking |
( |
| ) |
|
|
signal |
This signal is emitted when the player stops thinking of a move. Note that it doesn't necessarily mean that the player has made a move - they could've lost the game on time, disconnected, etc.
| virtual bool ChessPlayer::supportsVariant |
( |
const QString & |
variant | ) |
const |
|
pure virtual |
This signal is emitted when the player's evaluation of the current position changes.
Returns the player's time control.
Move evaluation for the current move.
This move evaluation may have eval info from multiple search depths if the highest depth doesn't contain a complete evaluation.
The documentation for this class was generated from the following files: