BoardSize class
Specifies the dimensions of a board.
Constructors
- BoardSize(int h, int v)
-
const
- BoardSize.fromString(String str)
-
Builds a BoardSize from a string like '8x8'.
factory
Properties
- h → int
-
The horizontal size, i.e. number of files on the board.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- 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
- north → int
-
The number of indices required to travel one square north.
no setter
- numIndices → int
-
The total number of indices in the internal board representation.
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
- simpleString → String
-
no setter
- v → int
-
The vertical size, i.e. number of ranks on the board.
final
Methods
-
connected(
int a, int b, Direction direction) → bool -
Whether
a
andb
are connected by a move indirection
. -
diagonallyConnected(
int a, int b) → bool -
Whether
a
andb
are connected by a bishop move. -
directionBetween(
int a, int b) → Direction -
Gets a Direction between
a
andb
. -
directionBetweenString(
String a, String b) → Direction -
a
andb
are square names like 'd4', 'h10'. -
directionTypeBetween(
int a, int b) → DirectionType -
Determine what sort of direction connects
a
andb
. -
directionTypeBetweenString(
String a, String b) → DirectionType -
a
andb
are square names like 'd4', 'h10'. -
file(
int square) → int -
Returns the rank that
square
is on. -
firstRank(
int colour) → int -
Get the first rank for player
colour
. -
inRegion(
int square, Region region) → bool -
isValidSquareName(
String name) → bool - Check whether a square name is valid for this board size.
-
lastRank(
int colour) → int -
Get the last rank (i.e. promotion rank) for player
colour
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onBoard(
int square) → bool - Determines whether a square is on the board.
-
orthogonallyConnected(
int a, int b) → bool -
Whether
a
andb
are connected by a rook move. -
rank(
int square) → int -
Returns that file that
square
is on. -
secretSquare(
int i) → int -
Gets the secret (off-board) square
i
, for storing flags in. -
square(
int file, int rank) → int -
Gets the square index at
file
andrank
. -
squareName(
int square) → String - Returns the name for a square, according to chess conventions, e.g. c6, b1.
-
squareNumber(
String name) → int -
Returns the square id for a square with
name
. -
squaresForArea(
int centre, Area area) → Iterable< int> -
Returns all the squares in
area
, translated tocentre
- a square id. -
squaresForRegion(
Region region) → Iterable< int> -
Returns all of the squares in
region
. If you want to find the squares for anArea
, usesquaresForArea()
. -
squaresOnSameFile(
int a, int b) → bool -
Returns true if
a
andb
are facing. Useful for Xiangqi's flying generals rule. -
squaresOnSameRank(
int a, int b) → bool -
Returns true if
a
andb
are on the same rank. -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override