Documentation

ChessPiece
in package

Table of Contents

Constants

BISHOP  = 4
KING  = 1
KNIGHT  = 5
PAWN  = 6
QUEEN  = 2
ROOK  = 3

Properties

$colour  : Colour
$pieceID  : int
$x  : int
$y  : int

Methods

__construct()  : mixed
getLetterForPiece()  : string
getPieceForLetter()  : self::*
getPieceLetter()  : string
getPieceSymbol()  : string
getPossibleMoves()  : array<string|int, array{: int, : int}>
getSymbolForPiece()  : string
isAttacking()  : bool
Check if the piece is attacking a specific square
isSafeMove()  : bool
addMove()  : bool

Constants

Properties

Methods

__construct()

public __construct(Colour $colour, int $pieceID, int $x, int $y) : mixed
Parameters
$colour : Colour
$pieceID : int
$x : int
$y : int

getLetterForPiece()

public static getLetterForPiece(int $pieceID, Colour $colour) : string
Parameters
$pieceID : int
$colour : Colour
Return values
string

getPieceForLetter()

public static getPieceForLetter(string $letter) : self::*
Parameters
$letter : string
Return values
self::*

getPieceLetter()

public getPieceLetter() : string
Return values
string

getPieceSymbol()

public getPieceSymbol() : string
Return values
string

getPossibleMoves()

public getPossibleMoves(Board $board[, bool $attackingCheck = false ]) : array<string|int, array{: int, : int}>
Parameters
$board : Board
$attackingCheck : bool = false
Return values
array<string|int, array{: int, : int}>

getSymbolForPiece()

public static getSymbolForPiece(int $pieceID, Colour $colour) : string
Parameters
$pieceID : int
$colour : Colour
Return values
string

isAttacking()

Check if the piece is attacking a specific square

public isAttacking(Board $board, int $x, int $y) : bool
Parameters
$board : Board
$x : int
$y : int
Return values
bool

isSafeMove()

public isSafeMove(Board $board, int $toX, int $toY) : bool
Parameters
$board : Board
$toX : int
$toY : int
Return values
bool

addMove()

private addMove(int $toX, int $toY, Board $board, array{: int, : int} &$moves[, bool $attackingCheck = true ]) : bool
Parameters
$toX : int
$toY : int
$board : Board
$moves : array{: int, : int}
$attackingCheck : bool = true
Return values
bool

        
On this page

Search results