Board class
Representation of playing board.
Contains informaion about current _position
and is able to perform
necessary operations on _position
, like move and undoMove.
Constructors
- Board()
-
Constructs new
Board
object with initialPosition. - Board.fromPosition({required Position position})
-
Constructs new
Board
object with givenposition
.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
at(
int row, int col) → Piece? -
Returns piece at position (
row
,col
) ornull
if square is empty. -
atSquare(
Square square) → Piece? -
Returns piece on
square
ornull
if square is empty. -
getFenRepresentation(
) → String -
Returns FEN representation of current
_position
on the board. -
move(
Move m) → PlayedMove -
Performs a move
m
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
safeMove(
Move m) → PlayedMove? -
Performs a move
m
, if the squarem.from
actually contains piece. -
safeUndoMove(
PlayedMove move) → bool -
Performs a
move
but in reverse order, if the squaremove.to
is not empty. -
toString(
) → String -
A string representation of this object.
inherited
-
toStringAsBlack(
) → String -
Returns a size by size looking
String
of current_position
as viewed by black player. -
toStringAsWhite(
) → String -
Returns a size by size looking
String
of current_position
as viewed by white player. -
undoMove(
PlayedMove move) → void -
Performs a
move
but in reverse order.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- initialPosition → Position
-
no setter