ChessGame
in package
Table of Contents
Constants
- END_CANCEL : int = 1
- END_RESIGN : int = 0
Properties
- $CACHE_CHESS_GAMES : array<int, self>
- $blackPlayerID : int
- $board : Board
- $chessGameID : int
- $endDate : int|null
- $gameID : int
- $lastMove : Loc}|null
- $moves : array<string|int, string>
- $startDate : int
- $whitePlayerID : int
- $winnerPlayerID : int
Methods
- __construct() : mixed
- getBlackPlayer() : Player
- getBlackPlayerID() : int
- getBoard() : Board
- getChessGame() : self
- getChessGameID() : int
- getColourForPlayerID() : Colour
- getColourPlayer() : Player
- getColourPlayerID() : int
- getCurrentTurnColour() : Colour
- getCurrentTurnPlayer() : Player
- getCurrentTurnPlayerID() : int
- getGameID() : int
- getLastMove() : Loc}|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
- getWhitePlayer() : Player
- getWhitePlayerID() : int
- getWinnerPlayerID() : int
- hasEnded() : bool
- hasWinner() : bool
- insertNewGame() : void
- isCastling() : Loc}|false
- 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 player ID one of the two players of this game?
- resign() : self::END_*
- setDraw() : void
- setWinner() : void
- tryAlgebraicMove() : void
- tryMove() : string
- createMove() : string
- updateEndedGame() : void
Constants
END_CANCEL
public
int
END_CANCEL
= 1
END_RESIGN
public
int
END_RESIGN
= 0
Properties
$CACHE_CHESS_GAMES
protected
static array<int, self>
$CACHE_CHESS_GAMES
= []
$blackPlayerID read-only
private
int
$blackPlayerID
$board
private
Board
$board
$chessGameID read-only
private
int
$chessGameID
$endDate
private
int|null
$endDate
$gameID read-only
private
int
$gameID
$lastMove
private
Loc}|null
$lastMove
= null
$moves
private
array<string|int, string>
$moves
$startDate read-only
private
int
$startDate
$whitePlayerID read-only
private
int
$whitePlayerID
$winnerPlayerID
private
int
$winnerPlayerID
Methods
__construct()
public
__construct(int $chessGameID) : mixed
Parameters
- $chessGameID : int
getBlackPlayer()
public
getBlackPlayer() : Player
Return values
PlayergetBlackPlayerID()
public
getBlackPlayerID() : int
Return values
intgetBoard()
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
intgetColourForPlayerID()
public
getColourForPlayerID(int $playerID) : Colour
Parameters
- $playerID : int
Return values
ColourgetColourPlayer()
public
getColourPlayer(Colour $colour) : Player
Parameters
- $colour : Colour
Return values
PlayergetColourPlayerID()
public
getColourPlayerID(Colour $colour) : int
Parameters
- $colour : Colour
Return values
intgetCurrentTurnColour()
public
getCurrentTurnColour() : Colour
Return values
ColourgetCurrentTurnPlayer()
public
getCurrentTurnPlayer() : Player
Return values
PlayergetCurrentTurnPlayerID()
public
getCurrentTurnPlayerID() : int
Return values
intgetGameID()
public
getGameID() : int
Return values
intgetLastMove()
public
getLastMove() : Loc}|null
Return values
Loc}|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(Player $player) : array<string|int, self>
Parameters
- $player : Player
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
intgetWhitePlayer()
public
getWhitePlayer() : Player
Return values
PlayergetWhitePlayerID()
public
getWhitePlayerID() : int
Return values
intgetWinnerPlayerID()
public
getWinnerPlayerID() : int
Return values
inthasEnded()
public
hasEnded() : bool
Return values
boolhasWinner()
public
hasWinner() : bool
Return values
boolinsertNewGame()
public
static insertNewGame(int $startDate, Player $whitePlayer, Player $blackPlayer) : void
Parameters
isCastling()
public
static isCastling(Loc $loc, Loc $toLoc) : Loc}|false
Parameters
Return values
Loc}|falseisCurrentTurn()
public
isCurrentTurn(int $playerID) : bool
Parameters
- $playerID : 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(Loc $loc) : bool
Parameters
- $loc : Loc
Return values
boolisNPCGame()
public
isNPCGame() : bool
Return values
boolisPlayer()
Is the given player ID one of the two players of this game?
public
isPlayer(int $playerID) : bool
Parameters
- $playerID : int
Return values
boolresign()
public
resign(int $playerID) : self::END_*
Parameters
- $playerID : int
Return values
self::END_*setDraw()
public
setDraw() : void
setWinner()
public
setWinner(Colour $winnerColour) : void
Parameters
- $winnerColour : Colour
tryAlgebraicMove()
public
tryAlgebraicMove(string $move) : void
Parameters
- $move : string
-
Algebraic notation like "b2b4"
tryMove()
public
tryMove(Loc $loc, Loc $toLoc, Colour $forColour, int $pawnPromotionPiece) : string
Parameters
Return values
stringcreateMove()
private
createMove(int $pieceID, Loc $startLoc, Loc $endLoc, int|null $pieceTaken, string|null $checking, Colour $playerColour, Castling|null $castling, bool $enPassant, int|null $promotionPieceID, bool $draw) : string
Parameters
- $pieceID : int
- $startLoc : Loc
- $endLoc : Loc
- $pieceTaken : int|null
- $checking : string|null
- $playerColour : Colour
- $castling : Castling|null
- $enPassant : bool
- $promotionPieceID : int|null
- $draw : bool
Return values
stringupdateEndedGame()
private
updateEndedGame(int $winnerPlayerID) : void
Parameters
- $winnerPlayerID : int