ChessBrowser
Extension to create interactive chess boards
Loading...
Searching...
No Matches
MediaWiki\Extension\ChessBrowser\SquareRelations Class Reference

Public Member Functions

 __construct (int $square1, int $square2)
 Can be used, but for chaining ::new is probably better.
 
 getDistance ()
 Get the distance between 2 squares.
 
 haveSameRank ()
 Returns whether two squares are on the same rank.
 
 haveSameFile ()
 Returns whether two squares are on the same file.
 

Static Public Member Functions

static new (int $square1, int $square2)
 For chaining.
 

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Extension\ChessBrowser\SquareRelations::__construct ( int $square1,
int $square2 )

Can be used, but for chaining ::new is probably better.

Parameters
int$square1Square as byte number where in Hex notation the first four bits (0xF0) are rank [1-8] and the second 4 bits (0x0F) are file [a-h]
int$square2Square as byte number where in Hex notation the first four bits (0xF0) are rank [1-8] and the second 4 bits (0x0F) are file [a-h]

Member Function Documentation

◆ getDistance()

MediaWiki\Extension\ChessBrowser\SquareRelations::getDistance ( )

Get the distance between 2 squares.

Returns
int

◆ haveSameFile()

MediaWiki\Extension\ChessBrowser\SquareRelations::haveSameFile ( )

Returns whether two squares are on the same file.

Returns
bool

◆ haveSameRank()

MediaWiki\Extension\ChessBrowser\SquareRelations::haveSameRank ( )

Returns whether two squares are on the same rank.

Returns
bool

◆ new()

static MediaWiki\Extension\ChessBrowser\SquareRelations::new ( int $square1,
int $square2 )
static

For chaining.

Parameters
int$square1
int$square2
Returns
SquareRelations

The documentation for this class was generated from the following file: