BoardState class

A representation of a state of a board. Stores the contents of each square in board, the turn to move, orientation of the board, and highlights in lastFrom, lastTo and checkSquare.

Constructors

BoardState({required List<String> board, int turn = Squares.white, int? orientation, int? lastFrom, int? lastTo, int? checkSquare})
const
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.
final
player int
no setter
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
turn int
Whose turn is it to play? 0 for white, 1 for black.
final
waitingPlayer int
The player whose turn it isn't.
no setter

Methods

clearBoard(BoardSize size) BoardState
copyWith({List<String>? board, int? turn, int? orientation, int? lastFrom, int? lastTo, int? checkSquare}) BoardState
fen([BoardSize size = BoardSize.standard]) String
Returns the fen string - the board part only.
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
playerForState(PlayState playState) int
toString() String
A string representation of this object.
inherited
updateSquares(Map<int, String> updates) BoardState

Operators

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