Skip to content

Querying the state of the game (2 Player)

Raluca D. Gaina edited this page Feb 12, 2018 · 1 revision

Some functions can be used to retrieve information of the current state of the game. StateObservationMulti provides information about the game (score, winner, game tick, available actions). Note that the methods are similar to the StateObservation class, but some of them require the ID of the player querying the state. See the most important functions:

State Observation functions Description
double getGameScore(int playerID) Gets the score, at this observation, of the player corresponding to playerID.
int getGameTick() Returns the game tick of this particular observation.
Types.WINNER[] getMultiGameWinner() Returns an array of type Types.WINNER, with length corresponding to the number of players in the game, indicating the win state of all players in the current game observation. For each player, the possible values in the array (ID corresponding to index in the array) are Types.WINNER.PLAYER_WINS, Types.WINNER.PLAYER_LOSES and Types.WINNER.NO_WINNER.
Dimension getWorldDimension() Returns the world dimensions, in pixels.
int getBlockSize() Indicates the width in pixels of a sprite in the game.
boolean isGameOver() Indicates if the game is over or if it hasn't finished yet.

Table of Contents:

Clone this wiki locally