BoardState class
A representation of a state of a board. Stores the contents of each square in board, the player to move, orientation of the board, and highlights in lastFrom, lastTo and checkSquare.
Constructors
-
BoardState({required List<
String> board, int player = WHITE, int? orientation, int? lastFrom, int? lastTo, int? checkSquare}) - BoardState.empty()
-
factory
Properties
-
board
→ List<
String> -
A list of the pieces on each square of the board.
An empty string indicates no piece is on the square. Otherwise, it should be
a single character string matching an entry in the
PieceSet
being used. Upper case is white, lower case is black.final - checkSquare → int?
-
If a king is in check, which square is it on?
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- lastFrom → int?
-
The square that the last move started on.
final
- lastTo → int?
-
The square that the last move finished on.
final
- orientation ↔ int
-
Determines which way around the board is facing.
0 (white) will place the white pieces at the bottom,
and 1 will place the black pieces there.
latefinal
- player → int
-
Whose turn is it to play?
0 for white, 1 for black.
final
-
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringify → bool?
-
If set to
true
, the toString method will be overridden to output this instance's props.no setterinherited
Methods
-
copyWith(
{List< String> ? board, int? player, int? orientation, int? lastFrom, int? lastTo, int? checkSquare}) → BoardState -
flipped(
) → BoardState -
Returns a
BoardState
identical to this one, but with orientation flipped. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited