InsanichessLiveGame class

Extends InsanichessGame with data that a server needs for bookkeeping and player's client needs to update UI accordingly.

This extension adds capabilities to InsanichessGame that are important only for games currently being played.

Inheritance

Constructors

InsanichessLiveGame({required bool undoAllowed, required String id, required InsanichessPlayer whitePlayer, required InsanichessPlayer blackPlayer, required InsanichessTimeControl timeControl})
Constructs new InsanichessLiveGame object.
InsanichessLiveGame.fromJson(Map<String, dynamic> json)
Creates new InsanichessLiveGame from json representation.

Properties

blackPlayer InsanichessPlayer
Information for player with black pieces.
finalinherited
blackWon bool
Returns true if the game was won by black.
no setterinherited
board → Board
Returns the current _board.
no setterinherited
canGoBackward bool
Is there a move in the past?
no setterinherited
canGoForward bool
Is there a future move?
no setterinherited
canUndo bool
Is there is a move that can be undone?
no setterinherited
hashCode int
hashCode for InsanichessGame is simply id.hashCode.
no setterinherited
id String
The id of the game.
finalinherited
inProgress bool
Returns true if the game is currently in progress.
no setterinherited
isGameOver bool
Returns whether the game is over or not.
no setterinherited
legalMoves List<Move>
no setterinherited
movesFromFuture List<PlayedMove>
Returns moves that are in the future. That means they were played but player went backward to explore move history.
no setterinherited
movesPlayed List<PlayedMove>
Returns moves played until current position.
no setterinherited
playerOfferedDraw ↔ PieceColor?
The color of the player that offered draw. If there is no player currently offering a draw, this field is null.
getter/setter pair
playerOnTurn → PieceColor
Returns the color of the playerOnTurn.
no setterinherited
playerRequestedUndo ↔ PieceColor?
The color of the player that offered draw. If there is no player currently requesting undo, this field is null.
getter/setter pair
remainingTimeBlack Duration
Remaining playing time for black.
getter/setter pairinherited
remainingTimeWhite Duration
Remaining playing time for white.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status → GameStatus
Returns the current status of the game.
no setterinherited
timeControl InsanichessTimeControl
Time control for the game.
finalinherited
timeOfLastMove DateTime?
The time when the last move has been played. Comparing this field to current time the time a player needed for a move is calculated.
getter/setter pair
timesSpentPerMove List<Duration>
The durations player needed for each move.
finalinherited
undoAllowed bool
Undo is allowed in this game if both players have set the "allow undo" setting to true in their InsanichessLiveGameSettings.
final
whitePlayer InsanichessPlayer
Information for player with white pieces.
finalinherited
whiteWon bool
Returns true if the game was won by white.
no setterinherited

Methods

backward() → PlayedMove?
Moves one move backward in the _gameHistory.
inherited
blackResigned() → void
Sets the current status to GameStatus.blackResigned.
inherited
draw() → void
Sets the current status to GameStatus.draw.
inherited
flagged([PieceColor? player]) → void
Sets the current status to GameStatus.whiteFlagged or GameStatus.blackFlagged, depending on who the player is.
inherited
forward() → PlayedMove?
Moves one move forward in the _gameHistory.
inherited
move(Move m) → PlayedMove?
Performs a move m on the board and updates _gameStatus.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toICString() String
Creates a String representation of a game. This representation contains in each line a pair of moves of white and black player, separated by ' ' character and game metadata at the start.
inherited
toJson() Map<String, Object?>
Converts this object to json representation.
override
toString() String
A string representation of this object.
inherited
undo() → PlayedMove?
Undoes the move on the board, removes last element of timesSpentPerMove and updated either remainingTimeWhite or remainingTimeBlack accordingly.
updateTime(Duration timeSpentForMove, PieceColor player) → void
Deducts timeSpentForMove from remaining time of the player and adds timeControl.incrementPerMove to it.
whiteResigned() → void
Sets the current status to GameStatus.whiteResigned.
inherited

Operators

operator ==(Object? other) bool
Two InsanichessGames are equal if they have the same id.
inherited