BoardSize class

Specifies the dimensions of a board.

Constructors

BoardSize(int h, int v)
const

Properties

aspectRatio double
Horizontal size divided by vertical size.
no setter
h int
The horizontal size, i.e. number of files on the board.
final
hashCode int
The hash code for this object.
no setterinherited
maxDim int
Returns the longest dimension.
no setter
maxFile int
Index of the last file.
no setter
maxRank int
Index of the last rank.
no setter
minDim int
Returns the shortest dimension.
no setter
numSquares int
The total number of squares on a board of this size.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
v int
The vertical size, i.e. number of ranks on the board.
final

Methods

fileDiff(int from, int to) int
Calculates the difference in files between two squares.
isDarkSquare(int square) bool
Returns true if square is a dark square.
isLightSquare(int square) bool
Returns true if square is a light square.
isOnBoard(int square) bool
Returns true if square is on the board.
moveFromAlgebraic(String alg) Move
Create a Move from an algebraic string (e.g. a2a3, g6f3) for a board of this size.
moveToAlgebraic(Move move) String
Returns an algebraic string (e.g. a2a3, g6f3), for a given move.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rankDiff(int from, int to) int
Calculates the difference in ranks between two squares.
square(int rank, int file, int orientation) int
Gets a square id for rank, file and orientation. Orientation can be 0 (white) or 1 (black);
squareFile(int square) int
Returns the file that square is on.
squareName(int square) String
Returns a human-readable name for a square on a board of this size. e.g. c1, h6.
squareNumber(String name) int
Converts a human-readable square name into an integer, corresponding to the correct square on a board of this size.
squareRank(int square) int
Returns the rank that square is on.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

standard → const BoardSize
A standard 8x8 board.