|
Cute Chess
0.1
|
A chess player controlled by a human user. More...
#include <humanplayer.h>
Public Slots | |
| void | onHumanMove (const Chess::GenericMove &move, const Chess::Side &side) |
Public Slots inherited from ChessPlayer | |
| virtual void | go () |
| virtual void | kill () |
| virtual void | quit () |
Signals | |
| void | wokeUp () |
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) |
Public Member Functions | |
| virtual void | endGame (const Chess::Result &result) |
| HumanPlayer (QObject *parent=nullptr) | |
| virtual bool | isHuman () const |
| virtual void | makeMove (const Chess::Move &move) |
| virtual bool | supportsVariant (const QString &variant) const |
Public Member Functions inherited from ChessPlayer | |
| bool | areClaimsValidated () const |
| ChessPlayer (QObject *parent=nullptr) | |
| virtual void | clearPonderState () |
| QString | errorString () const |
| const MoveEvaluation & | evaluation () const |
| bool | hasError () const |
| virtual bool | isReady () 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 TimeControl * | timeControl () const |
Protected Member Functions | |
| virtual void | startGame () |
| virtual void | startThinking () |
Protected Member Functions inherited from ChessPlayer | |
| Chess::Board * | board () |
| 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 ChessPlayer * | opponent () const |
| void | setError (const QString &error) |
| void | setState (State state) |
Additional Inherited Members | |
Public Types inherited from ChessPlayer | |
| enum | State { NotStarted, Starting, Idle, Observing, Thinking, FinishingGame, Disconnected } |
Protected Slots inherited from ChessPlayer | |
| virtual void | onCrashed () |
| virtual void | onTimeout () |
Protected Attributes inherited from ChessPlayer | |
| MoveEvaluation | m_eval |
A chess player controlled by a human user.
A HumanPlayer object works between a graphical chessboard and a ChessGame object by forwarding the user's moves to the game.
Typically human players are created by using a HumanBuilder object.
| HumanPlayer::HumanPlayer | ( | QObject * | parent = nullptr | ) |
Creates a new human player.
|
virtual |
Tells the player that the game ended by result.
Reimplemented from ChessPlayer.
|
virtual |
Returns true if the player is human.
Implements ChessPlayer.
|
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.
|
slot |
Plays move as the human player's next move if side is the player's side and the move is legal; otherwise does nothing.
If the player is in Thinking state, it plays the move immediately. If its in Observing state, it saves the move for later, emits the wokeUp() signal, and plays the move when it gets its turn.
|
protectedvirtual |
Starts the chess game set up by newGame().
Implements ChessPlayer.
|
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.
|
virtual |
Returns true if the player can play variant.
Implements ChessPlayer.
|
signal |
This signal is emitted when the player receives a user-made move in Observing state.
Normally this signal is connected to ChessGame::resume() to resume a paused game when the user makes a move.
1.8.11