Documentation

Loc
in package

Read onlyYes

Represents positions on a chess board.

Table of Contents

Constants

MAX_X  = \Smr\Chess\Board::NX - 1
MAX_Y  = \Smr\Chess\Board::NY - 1

Properties

$x  : int
$y  : int

Methods

__construct()  : mixed
algebraic()  : string
Convert the x,y position to algebraic notation.
at()  : self
file()  : string
rank()  : int
relative()  : self
relativeOrNull()  : self|null
same()  : bool
validate()  : self
validateOrNull()  : self|null
isValid()  : bool

Constants

MAX_X

public mixed MAX_X = \Smr\Chess\Board::NX - 1

MAX_Y

public mixed MAX_Y = \Smr\Chess\Board::NY - 1

Properties

Methods

__construct()

public __construct(int<0, self::MAX_X> $x, int<0, self::MAX_Y> $y) : mixed
Parameters
$x : int<0, self::MAX_X>
$y : int<0, self::MAX_Y>

algebraic()

Convert the x,y position to algebraic notation.

public algebraic() : string
Return values
string

at()

public static at(string $coord) : self
Parameters
$coord : string
Return values
self

file()

public file() : string
Return values
string

rank()

public rank() : int
Return values
int

relative()

public relative([int $dx = 0 ][, int $dy = 0 ]) : self
Parameters
$dx : int = 0
$dy : int = 0
Return values
self

relativeOrNull()

public relativeOrNull([int $dx = 0 ][, int $dy = 0 ]) : self|null
Parameters
$dx : int = 0
$dy : int = 0
Return values
self|null

same()

public same(self $other) : bool
Parameters
$other : self
Return values
bool

validate()

public static validate(int $x, int $y) : self
Parameters
$x : int
$y : int
Return values
self

validateOrNull()

public static validateOrNull(int $x, int $y) : self|null
Parameters
$x : int
$y : int
Return values
self|null

isValid()

private static isValid(int $x, int $y) : bool
Parameters
$x : int
$y : int
Tags
phpstan-assert-if-true

int<0, self::MAX_X> $x

phpstan-assert-if-true

int<0, self::MAX_Y> $y

Return values
bool

        
On this page

Search results