Square

dicechess.engine.domain.Models$package.Square
object Square

Represents a chess board square index.

The index ranges from 0 (a1) to 63 (h8), mapped row by row (a1, b1... h8).

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Square.type

Members list

Value members

Concrete methods

def apply(file: Char, rank: Int): Square

Builds a square from coordinate syntax.

Builds a square from coordinate syntax.

Attributes

def fromIndex(idx: Int): Square

Directly injects a pre-validated raw index.

Directly injects a pre-validated raw index.

Attributes

def fromNotation(notation: String): Option[Square]

Parses an algebraic square notation string (e.g. "e4") into a Square.

Parses an algebraic square notation string (e.g. "e4") into a Square.

Value parameters

notation

two-character string: file letter ah followed by rank digit 18

Attributes

Returns

Some(square) if the notation is valid, None otherwise

Extensions

Extensions

extension (sq: Square)
inline def file: Char

File letter ('a''h') derived from the square index.

File letter ('a''h') derived from the square index.

Attributes

inline def index: Int

Raw LERF index in [0, 63] (0 = a1, 63 = h8).

Raw LERF index in [0, 63] (0 = a1, 63 = h8).

Attributes

inline def rank: Int

Rank number (18) derived from the square index.

Rank number (18) derived from the square index.

Attributes

inline def toNotation: String

Algebraic notation string, e.g. "e4".

Algebraic notation string, e.g. "e4".

Attributes