public class StateObservation
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
Types.GAMESTATES |
currentGameState
Field to represent the current game's state.
|
protected ForwardModel |
model
This is the model of the game, used to apply an action and
get to the next state.
|
Constructor and Description |
---|
StateObservation(ForwardModel a_model,
int playerID)
Constructor for StateObservation.
|
Modifier and Type | Method and Description |
---|---|
void |
advance(Types.ACTIONS action)
Advances the state using the action passed as the move of the agent.
|
StateObservation |
copy()
Returns an exact copy of the state observation object.
|
boolean |
equiv(java.lang.Object o)
Compares if this and the received StateObservation state are equivalent.
|
java.util.ArrayList<Types.ACTIONS> |
getAvailableActions()
Returns the actions that are available in this game for
the avatar.
|
java.util.ArrayList<Types.ACTIONS> |
getAvailableActions(boolean includeNIL)
Returns the actions that are available in this game for
the avatar.
|
int |
getAvatarHealthPoints()
Returns the health points of the avatar.
|
Types.ACTIONS |
getAvatarLastAction()
Returns the avatar's last move.
|
int |
getAvatarLimitHealthPoints()
Returns the limit of health points this avatar can have.
|
int |
getAvatarMaxHealthPoints()
Returns the maximum amount of health points.
|
Vector2d |
getAvatarOrientation()
Returns the orientation of the avatar.
|
Vector2d |
getAvatarPosition()
Returns the position of the avatar.
|
java.util.HashMap<java.lang.Integer,java.lang.Integer> |
getAvatarResources()
Returns the resources in the avatar's possession.
|
double |
getAvatarSpeed()
Returns the speed of the avatar.
|
int |
getAvatarType()
Returns the avatar's type.
|
int |
getBlockSize()
Indicates how many pixels form a block in the game.
|
java.util.TreeSet<Event> |
getEventsHistory()
This method retrieves a list of events that happened so far in the game.
|
java.util.ArrayList<Observation>[] |
getFromAvatarSpritesPositions()
Returns a list of observations of sprites created by the avatar (usually, by applying the
action Types.ACTIONS.ACTION_USE).
|
java.util.ArrayList<Observation>[] |
getFromAvatarSpritesPositions(Vector2d reference)
Returns a list of observations of sprites created by the avatar (usually, by applying the
action Types.ACTIONS.ACTION_USE).
|
double |
getGameScore()
Gets the score of the game at this observation.
|
Types.GAMESTATES |
getGameState()
Return the current state of the game
|
int |
getGameTick()
Returns the game tick of this particular observation.
|
Types.WINNER |
getGameWinner()
Indicates if there is a game winner in the current observation.
|
java.util.ArrayList<Observation>[] |
getImmovablePositions()
Returns a list of observations of immovable sprites in the game.
|
java.util.ArrayList<Observation>[] |
getImmovablePositions(Vector2d reference)
Returns a list of observations of immovable sprites in the game.
|
KeyHandler |
getKeyHandler(int playerID)
Returns key handler available to the player.
|
java.util.ArrayList<Observation>[] |
getMovablePositions()
Returns a list of observations of sprites that move, but are NOT NPCs in the game.
|
java.util.ArrayList<Observation>[] |
getMovablePositions(Vector2d reference)
Returns a list of observations of movable (not NPCs) sprites in the game.
|
int |
getNoPlayers()
Returns the number of players in the game.
|
java.util.ArrayList<Observation>[] |
getNPCPositions()
Returns a list of observations of NPC in the game.
|
java.util.ArrayList<Observation>[] |
getNPCPositions(Vector2d reference)
Returns a list of observations of NPC in the game.
|
java.util.ArrayList<Observation>[][] |
getObservationGrid()
Returns a grid with all observations in the level, accessible by the x,y coordinates
of the grid.
|
java.util.ArrayList<Observation>[] |
getPortalsPositions()
Returns a list of observations of portals in the game.
|
java.util.ArrayList<Observation>[] |
getPortalsPositions(Vector2d reference)
Returns a list of observations of portals in the game.
|
java.util.ArrayList<Observation>[] |
getResourcesPositions()
Returns a list of observations of resources in the game.
|
java.util.ArrayList<Observation>[] |
getResourcesPositions(Vector2d reference)
Returns a list of observations of resources in the game.
|
java.awt.Dimension |
getWorldDimension()
Returns the world dimensions, in pixels.
|
boolean |
isAvatarAlive()
returns true if the avatar is alive.
|
boolean |
isGameOver()
Indicates if the game is over or if it hasn't finished yet.
|
void |
setNewSeed(int seed)
Sets a new seed for the forward model's random generator (creates a new object)
|
protected ForwardModel model
public Types.GAMESTATES currentGameState
public StateObservation(ForwardModel a_model, int playerID)
a_model
- forward model of the game.public StateObservation copy()
public void advance(Types.ACTIONS action)
action
- agent action to execute in the next cycle.public void setNewSeed(int seed)
seed
- the new seed.public Types.GAMESTATES getGameState()
public java.util.ArrayList<Types.ACTIONS> getAvailableActions()
public java.util.ArrayList<Types.ACTIONS> getAvailableActions(boolean includeNIL)
includeNIL
- true to include Types.ACTIONS.ACTION_NIL in the array of actions.public int getNoPlayers()
public double getGameScore()
public int getGameTick()
public Types.WINNER getGameWinner()
public boolean isGameOver()
public java.awt.Dimension getWorldDimension()
public int getBlockSize()
public Vector2d getAvatarPosition()
public double getAvatarSpeed()
public Vector2d getAvatarOrientation()
public java.util.HashMap<java.lang.Integer,java.lang.Integer> getAvatarResources()
public Types.ACTIONS getAvatarLastAction()
public int getAvatarType()
public int getAvatarHealthPoints()
public int getAvatarMaxHealthPoints()
public int getAvatarLimitHealthPoints()
public boolean isAvatarAlive()
public java.util.ArrayList<Observation>[][] getObservationGrid()
public java.util.TreeSet<Event> getEventsHistory()
public java.util.ArrayList<Observation>[] getNPCPositions()
public java.util.ArrayList<Observation>[] getNPCPositions(Vector2d reference)
reference
- Reference position to use when sorting this array,
by ascending distance to this point.public java.util.ArrayList<Observation>[] getImmovablePositions()
public java.util.ArrayList<Observation>[] getImmovablePositions(Vector2d reference)
reference
- Reference position to use when sorting this array,
by ascending distance to this point.public java.util.ArrayList<Observation>[] getMovablePositions()
public java.util.ArrayList<Observation>[] getMovablePositions(Vector2d reference)
reference
- Reference position to use when sorting this array,
by ascending distance to this point.public java.util.ArrayList<Observation>[] getResourcesPositions()
public java.util.ArrayList<Observation>[] getResourcesPositions(Vector2d reference)
reference
- Reference position to use when sorting this array,
by ascending distance to this point.public java.util.ArrayList<Observation>[] getPortalsPositions()
public java.util.ArrayList<Observation>[] getPortalsPositions(Vector2d reference)
reference
- Reference position to use when sorting this array,
by ascending distance to this point.public java.util.ArrayList<Observation>[] getFromAvatarSpritesPositions()
public java.util.ArrayList<Observation>[] getFromAvatarSpritesPositions(Vector2d reference)
reference
- Reference position to use when sorting this array,
by ascending distance to this point.public KeyHandler getKeyHandler(int playerID)
playerID
- ID of the player to query.public boolean equiv(java.lang.Object o)
o
- Object to compare this to.