Documentation

ChessPiece
in package

Table of Contents

Constants

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

Properties

$colour  : Colour
$loc  : Loc
$pieceID  : int

Methods

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

Constants

Properties

Methods

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, Loc>
Parameters
$board : Board
$attackingCheck : bool = false
Return values
array<string|int, Loc>

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, Loc $loc) : bool
Parameters
$board : Board
$loc : Loc
Return values
bool

addMove()

private addMove(int $dx, int $dy, Board $board, array<int, Loc&$moves[, bool $attackingCheck = true ]) : bool
Parameters
$dx : int
$dy : int
$board : Board
$moves : array<int, Loc>
$attackingCheck : bool = true
Return values
bool

        
On this page

Search results