ChessGame
in package
Table of Contents
Constants
- END_CANCEL = 1
- END_RESIGN = 0
Properties
- $CACHE_CHESS_GAMES : array<int, self>
- $blackID : int
- $board : Board
- $chessGameID : int
- $endDate : int|null
- $gameID : int
- $lastMove : array<string, array<string, int>>|null
- $moves : array<string|int, string>
- $startDate : int
- $whiteID : int
- $winner : int
Methods
- __construct() : mixed
- getBlackAccount() : Account
- getBlackID() : int
- getBlackPlayer() : AbstractPlayer
- getBoard() : Board
- getChessGame() : self
- getChessGameID() : int
- getColourForAccountID() : Colour
- getColourID() : int
- getColourPlayer() : AbstractPlayer
- getCurrentTurnAccount() : Account
- getCurrentTurnAccountID() : int
- getCurrentTurnColour() : Colour
- getCurrentTurnPlayer() : AbstractPlayer
- getGameID() : int
- getLastMove() : array<string, array<string, int>>|null
- getMoves() : array<string|int, string>
- getNPCMoveGames() : array<string|int, self>
- getOngoingPlayerGames() : array<string|int, self>
- getPlayGameHREF() : string
- getResignHREF() : string
- getStandardGame() : array<string|int, ChessPiece>
- getStartDate() : int
- getWhiteAccount() : Account
- getWhiteID() : int
- getWhitePlayer() : AbstractPlayer
- getWinner() : int
- hasEnded() : bool
- hasWinner() : bool
- insertNewGame() : void
- isCastling() : Castling, X: int, ToX: int}|false
- isCheckmated() : bool
- isCurrentTurn() : bool
- isLastMoveSquare() : bool
- Determines if a board square is part of the last move (returns true for both the 'To' and 'From' squares).
- isNPCGame() : bool
- isPlayer() : bool
- Is the given account ID one of the two players of this game?
- resign() : self::END_*
- setWinner() : array<string, AbstractPlayer>
- tryAlgebraicMove() : void
- tryMove() : string
- createMove() : string
Constants
END_CANCEL
public
mixed
END_CANCEL
= 1
END_RESIGN
public
mixed
END_RESIGN
= 0
Properties
$CACHE_CHESS_GAMES
protected
static array<int, self>
$CACHE_CHESS_GAMES
= []
$blackID read-only
private
int
$blackID
$board
private
Board
$board
$chessGameID read-only
private
int
$chessGameID
$endDate
private
int|null
$endDate
$gameID read-only
private
int
$gameID
$lastMove
private
array<string, array<string, int>>|null
$lastMove
= null
$moves
private
array<string|int, string>
$moves
$startDate read-only
private
int
$startDate
$whiteID read-only
private
int
$whiteID
$winner
private
int
$winner
Methods
__construct()
public
__construct(int $chessGameID) : mixed
Parameters
- $chessGameID : int
getBlackAccount()
public
getBlackAccount() : Account
Return values
AccountgetBlackID()
public
getBlackID() : int
Return values
intgetBlackPlayer()
public
getBlackPlayer() : AbstractPlayer
Return values
AbstractPlayergetBoard()
public
getBoard() : Board
Return values
BoardgetChessGame()
public
static getChessGame(int $chessGameID[, bool $forceUpdate = false ]) : self
Parameters
- $chessGameID : int
- $forceUpdate : bool = false
Return values
selfgetChessGameID()
public
getChessGameID() : int
Return values
intgetColourForAccountID()
public
getColourForAccountID(int $accountID) : Colour
Parameters
- $accountID : int
Return values
ColourgetColourID()
public
getColourID(Colour $colour) : int
Parameters
- $colour : Colour
Return values
intgetColourPlayer()
public
getColourPlayer(Colour $colour) : AbstractPlayer
Parameters
- $colour : Colour
Return values
AbstractPlayergetCurrentTurnAccount()
public
getCurrentTurnAccount() : Account
Return values
AccountgetCurrentTurnAccountID()
public
getCurrentTurnAccountID() : int
Return values
intgetCurrentTurnColour()
public
getCurrentTurnColour() : Colour
Return values
ColourgetCurrentTurnPlayer()
public
getCurrentTurnPlayer() : AbstractPlayer
Return values
AbstractPlayergetGameID()
public
getGameID() : int
Return values
intgetLastMove()
public
getLastMove() : array<string, array<string, int>>|null
Return values
array<string, array<string, int>>|nullgetMoves()
public
getMoves() : array<string|int, string>
Return values
array<string|int, string>getNPCMoveGames()
public
static getNPCMoveGames([bool $forceUpdate = false ]) : array<string|int, self>
Parameters
- $forceUpdate : bool = false
Return values
array<string|int, self>getOngoingPlayerGames()
public
static getOngoingPlayerGames(AbstractPlayer $player) : array<string|int, self>
Parameters
- $player : AbstractPlayer
Return values
array<string|int, self>getPlayGameHREF()
public
getPlayGameHREF() : string
Return values
stringgetResignHREF()
public
getResignHREF() : string
Return values
stringgetStandardGame()
public
static getStandardGame() : array<string|int, ChessPiece>
Return values
array<string|int, ChessPiece>getStartDate()
public
getStartDate() : int
Return values
intgetWhiteAccount()
public
getWhiteAccount() : Account
Return values
AccountgetWhiteID()
public
getWhiteID() : int
Return values
intgetWhitePlayer()
public
getWhitePlayer() : AbstractPlayer
Return values
AbstractPlayergetWinner()
public
getWinner() : int
Return values
inthasEnded()
public
hasEnded() : bool
Return values
boolhasWinner()
public
hasWinner() : bool
Return values
boolinsertNewGame()
public
static insertNewGame(int $startDate, AbstractPlayer $whitePlayer, AbstractPlayer $blackPlayer) : void
Parameters
- $startDate : int
- $whitePlayer : AbstractPlayer
- $blackPlayer : AbstractPlayer
isCastling()
public
static isCastling(int $x, int $toX) : Castling, X: int, ToX: int}|false
Parameters
- $x : int
- $toX : int
Return values
Castling, X: int, ToX: int}|falseisCheckmated()
public
isCheckmated(Colour $colour) : bool
Parameters
- $colour : Colour
Return values
boolisCurrentTurn()
public
isCurrentTurn(int $accountID) : bool
Parameters
- $accountID : int
Return values
boolisLastMoveSquare()
Determines if a board square is part of the last move (returns true for both the 'To' and 'From' squares).
public
isLastMoveSquare(int $x, int $y) : bool
Parameters
- $x : int
- $y : int
Return values
boolisNPCGame()
public
isNPCGame() : bool
Return values
boolisPlayer()
Is the given account ID one of the two players of this game?
public
isPlayer(int $accountID) : bool
Parameters
- $accountID : int
Return values
boolresign()
public
resign(int $accountID) : self::END_*
Parameters
- $accountID : int
Return values
self::END_*setWinner()
public
setWinner(int $accountID) : array<string, AbstractPlayer>
Parameters
- $accountID : int
Return values
array<string, AbstractPlayer>tryAlgebraicMove()
public
tryAlgebraicMove(string $move) : void
Parameters
- $move : string
-
Algebraic notation like "b2b4"
tryMove()
public
tryMove(int $x, int $y, int $toX, int $toY, Colour $forColour, int $pawnPromotionPiece) : string
Parameters
- $x : int
- $y : int
- $toX : int
- $toY : int
- $forColour : Colour
- $pawnPromotionPiece : int
Return values
stringcreateMove()
private
createMove(int $pieceID, int $startX, int $startY, int $endX, int $endY, int|null $pieceTaken, string|null $checking, Colour $playerColour, Castling|null $castling, bool $enPassant, int|null $promotionPieceID) : string
Parameters
- $pieceID : int
- $startX : int
- $startY : int
- $endX : int
- $endY : int
- $pieceTaken : int|null
- $checking : string|null
- $playerColour : Colour
- $castling : Castling|null
- $enPassant : bool
- $promotionPieceID : int|null