Game<E extends Event> class abstract

Abstract class that all games must inherit from

Available extensions

Constructors

Game()

Properties

currentPlayer Player?

Available on Game<Event>, provided by the GameX extension

Gets the current Player or null if the game is not turn based
no setter
currentPlayerID String

Available on Game<Event>, provided by the GameX extension

Gets the current Player ID
no setter
currentPlayerIndex int?

Available on Game<Event>, provided by the GameX extension

Gets the current player's index
no setter
gameOver bool

Available on Game<Event>, provided by the GameX extension

Gets whether the game is over
no setter
generic GenericGame
generic game holding some commonly used state
no setter
hashCode int
The hash code for this object.
no setterinherited
isMultiPly bool

Available on Game<Event>, provided by the GameX extension

Gets whether the game has multiple actions before a reward
no setter
isSimultaneousAction bool

Available on Game<Event>, provided by the GameX extension

Gets whether the game is simultaneous action at this ply
no setter
messages IList<GameMessage>

Available on Game<Event>, provided by the GameX extension

Gets the list of GameMessages that have been exchanged this game
no setter
playerIDs IList<PlayerID>

Available on Game<Event>, provided by the GameX extension

Gets the players that are a part of this game
no setter
playerRoundScores IMap<PlayerID, IList<double>>

Available on Game<Event>, provided by the GameX extension

Gets the list of round scores for each player mapped by their id
no setter
players IList<Player>

Available on Game<Event>, provided by the GameX extension

Gets an unmodifiable list of players that are a part of this game
no setter
readyPlayers IList<PlayerID>

Available on Game<Event>, provided by the GameX extension

Gets the players who are ready for the next round
no setter
round int

Available on Game<Event>, provided by the GameX extension

Gets the current round number
no setter
roundOver bool

Available on Game<Event>, provided by the GameX extension

Gets whether the round is over
no setter
roundPlayerScores IList<IMap<PlayerID, double>>

Available on Game<Event>, provided by the GameX extension

Gets the map of player scores grouped by round
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status GameStatus

Available on Game<Event>, provided by the GameX extension

Gets the status of the game
no setter
time DateTime

Available on Game<Event>, provided by the GameX extension

Gets the DateTime that this state was updated
no setter
totalScores IMap<PlayerID, double>

Available on Game<Event>, provided by the GameX extension

Gets the total score for each player mapped by player id
no setter
type GameType
Returns the name game type that is registered for serialization
no setter

Methods

copyWithGeneric(GenericGame updates(GenericGame)) Game<Event>
Copies the state of the game with generic replaced by the function applying updates to the most recent copy of generic
gameValue<G extends Game<E>>() GameOrError<G>

Available on Game<E>, provided by the GameOrErrorGameX extension

moveNextRound(GameConfig config) Game<Event>
Logic to apply after all players have consented they want to play another round to initialize the next round
next(E event) GameOrError<Game<Event>>
This method takes an event and returns the changed game state or an error
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes the state for consumption by the frontend
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

gameNames Map<GameType, String>
Stores the user friendly name of the game based on the type
final

Static Methods

fromJson(Map<String, dynamic> json) Game<Event>
Converts the game from json to the particular type based on the type field
gameEventFromJson(Map<String, dynamic> json) GameEvent
Returns the game event translated from json
getInitialState(GameConfig gameConfig, IList<Player> players) Game<Event>
Will get the initial state for a particular configuration
registerGameType<T extends Game<Event>, Q extends Game<Event>>(GameType type, {required String name, required Q fromJson(Map<String, dynamic>), required T initialState(GameConfig, IList<Player>), required GameEvent gameEventFromJson(Map<String, dynamic>), Q toClientView(T)?}) → void
Registers a game type with the server
toClientView(Game<Event> g) Game<Event>
Optionally converts the game from a full game state to a view of the game from the client's perspective