BishopState class

A record of the game's state at a particular move.

Implementers

Constructors

BishopState({required List<int> board, Move? move, StateMeta? meta, required Colour turn, required int halfMoves, required int fullMoves, required CastlingRights castlingRights, int? epSquare, required List<int> royalSquares, required List<List<int>> virginFiles, List<Hand>? hands, List<Hand>? gates, required List<int> pieces, List<int> checks = const [0, 0], GameResult? result, int hash = 0})
const

Properties

blackPieceCount int
no setter
board List<int>
The contents of each square on the board.
final
castlingRights CastlingRights
The current castling rights of both players.
final
checks List<int>
The number of times each player has been checked. For use with variants such as three-check.
final
epSquare int?
The en passant square, if one is available.
final
fullMoves int
How many full moves have been played in the entire game.
final
gates List<Hand>?
Two lists of pieces, for each player's gate. Index 0 - white, index 1 - black.
final
halfMoves int
How many half moves have been played since the last capture or pawn move.
final
hands List<Hand>?
Two lists of pieces, for each player's hand. Index 0 - white, index 1 - black.
final
hash int
The Zobrist hash of the game state. Needs to be set after construction of the first hash, but otherwise is updated in Game.makeMove().
final
hashCode int
The hash code for this object.
no setterinherited
invalidMove bool
no setter
meta StateMeta?
Contains the string representations of move, and the variant. Since these can be expensive to calculate, this will only be present in mainline moves, i.e. moves actually made by a player, rather than ones being generated for move legalisation.
final
move Move?
The previous move that was played. If null, the game has just started.
final
moveNumber int
no setter
pieces List<int>
A list of pieces each player has.
final
result GameResult?
This should be null most of the time. Used to indicate special case win conditions that have been met by a preceding move.
final
royalSquares List<int>
The squares the kings (or equivalent) currently reside on. Index 0 - white, index 1 - black.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
turn Colour
The player who can make the next move.
final
virginFiles List<List<int>>
A list of files that have been untouched for each player. For use with e.g. Seirawan chess, where pieces can only be gated on files that haven't had their pieces move yet. Only works for variants where all non-pawn pieces start on the back rank.
final
whitePieceCount int
no setter

Methods

applyEffects({required Iterable<ActionEffect> effects, required BoardSize size, Zobrist? zobrist}) BishopState
ascii({bool unicode = false, BuiltVariant? variant}) String
Generates an ASCII representation of the board.
capturedPieces() Map<String, int>
Returns a map of all captured pieces. This assumes that the game started with the same number of pieces as are present in the start position of the variant. NOTE: this function will crash for states with no meta, so only use this on the mainline.
capturedPiecesList() List<String>
Returns a list of all captured pieces. /// This assumes that the game started with the same number of pieces as are present in the start position of the variant. NOTE: this function will crash for states with no meta, so only use this on the mainline.
copyWith({List<int>? board, Move? move, StateMeta? meta, Colour? turn, int? halfMoves, int? fullMoves, CastlingRights? castlingRights, int? epSquare, List<int>? royalSquares, List<List<int>>? virginFiles, List<Hand>? hands, List<Hand>? gates, List<int>? pieces, List<int>? checks, GameResult? result, int? hash}) BishopState
executeActions({required ActionTrigger trigger, Iterable<Action>? actions, Zobrist? zobrist}) BishopState
handPieceTypes(int colour) Set<int>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pieceCount(int player) int
The total number of pieces currently in play belonging to player.
pieceOnSquare(String square) String
toString() String
A string representation of this object.
override
transform([int? player]) BishopState

Operators

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