Loc
in package
Read onlyYes
Represents positions on a chess board.
Table of Contents
Constants
Properties
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
$x
public
int
$x
$y
public
int
$y
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
stringat()
public
static at(string $coord) : self
Parameters
- $coord : string
Return values
selffile()
public
file() : string
Return values
stringrank()
public
rank() : int
Return values
intrelative()
public
relative([int $dx = 0 ][, int $dy = 0 ]) : self
Parameters
- $dx : int = 0
- $dy : int = 0
Return values
selfrelativeOrNull()
public
relativeOrNull([int $dx = 0 ][, int $dy = 0 ]) : self|null
Parameters
- $dx : int = 0
- $dy : int = 0
Return values
self|nullsame()
public
same(self $other) : bool
Parameters
- $other : self
Return values
boolvalidate()
public
static validate(int $x, int $y) : self
Parameters
- $x : int
- $y : int
Return values
selfvalidateOrNull()
public
static validateOrNull(int $x, int $y) : self|null
Parameters
- $x : int
- $y : int
Return values
self|nullisValid()
private
static isValid(int $x, int $y) : bool
Parameters
- $x : int
- $y : int