Documentation

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

Properties

$CACHE_CHESS_GAMES

protected static array<int, self> $CACHE_CHESS_GAMES = []

$chessGameID read-only

private int $chessGameID

$lastMove

private array<string, array<string, int>>|null $lastMove = null

$moves

private array<string|int, string> $moves

Methods

__construct()

public __construct(int $chessGameID) : mixed
Parameters
$chessGameID : int

getBlackID()

public getBlackID() : int
Return values
int

getChessGame()

public static getChessGame(int $chessGameID[, bool $forceUpdate = false ]) : self
Parameters
$chessGameID : int
$forceUpdate : bool = false
Return values
self

getChessGameID()

public getChessGameID() : int
Return values
int

getColourForAccountID()

public getColourForAccountID(int $accountID) : Colour
Parameters
$accountID : int
Return values
Colour

getCurrentTurnAccountID()

public getCurrentTurnAccountID() : int
Return values
int

getGameID()

public getGameID() : int
Return values
int

getLastMove()

public getLastMove() : array<string, array<string, int>>|null
Return values
array<string, array<string, int>>|null

getMoves()

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
string

getResignHREF()

public getResignHREF() : string
Return values
string

getStartDate()

public getStartDate() : int
Return values
int

getWhiteID()

public getWhiteID() : int
Return values
int

getWinner()

public getWinner() : int
Return values
int

hasEnded()

public hasEnded() : bool
Return values
bool

hasWinner()

public hasWinner() : bool
Return values
bool

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}|false

isCheckmated()

public isCheckmated(Colour $colour) : bool
Parameters
$colour : Colour
Return values
bool

isCurrentTurn()

public isCurrentTurn(int $accountID) : bool
Parameters
$accountID : int
Return values
bool

isLastMoveSquare()

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
bool

isNPCGame()

public isNPCGame() : bool
Return values
bool

isPlayer()

Is the given account ID one of the two players of this game?

public isPlayer(int $accountID) : bool
Parameters
$accountID : int
Return values
bool

resign()

public resign(int $accountID) : self::END_*
Parameters
$accountID : int
Return values
self::END_*

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
string

createMove()

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
Return values
string

        
On this page

Search results