Game
Represents a Reversi game, managing the game state, player turns, and interactions with storage. The game has two modes: local and not local.
Local Game
In a local game, if currGameName is null.
Not Local Game
In a not local game, currGameName is not null. The game state is saved and loaded from storage.
Constructors
Properties
Functions
Changes the player's piece type.
Checks if it's the player's turn in a not local game.
Closes the storage connection.
Gets the available plays for the current player. If it is not a local game, and it is not the player's turn, returns an empty list.
Ensures both players are available either locally or in persisted storage.
Plays a move at the specified coordinate. Saves the piece to data access if the game is not local. Only check player turn if it is a not local game. And resets the pass count to 0.
Reloads the core configuration.
Ensures that the game has started by checking if the game state and players are initialized.
Saves the current game state to storage. Saves the player in storage if not already present (makes available this player for future loads). It is recommended to use this method only to save the game at the end. Only applicable for not local games (players size must be 1).
Saves only the play-related state (board and last player) to storage. Keeps the existing players in storage unchanged. It is recommended to use this method during gameplay to save progress. Only applicable for not local games (players size must be 1).
Sets the target mode for the game.
Converts the game board to a string representation with row/column labels and target markers. If target mode is enabled, available plays are marked with the target character.