public class ForwardModel extends Game
Game.Bucket
avatar, block_size, bucketList, charMapping, classConst, collisionEffects, definedEffects, definedEOSEffects, eosEffects, frame_rate, fwdModel, gameTick, historicEvents, is_stochastic, isEnded, iSubTypes, ki, kill_list, MAX_SPRITES, nextSpriteID, num_sprites, resources_colors, resources_limits, score, screenSize, singletons, size, spriteGroups, spriteOrder, terminations, winner
Constructor and Description |
---|
ForwardModel(Game a_gameState)
Constructor for StateObservation.
|
Modifier and Type | Method and Description |
---|---|
void |
advance(Types.ACTIONS action)
Advances the forward model using the acction supplied.
|
void |
buildLevel(java.lang.String gamelvl)
Builds a level, receiving a file name.
|
ForwardModel |
copy()
Creates a copy of this forward model.
|
java.util.ArrayList<Types.ACTIONS> |
getAvatarActions()
Returns the actions that are available in this game for
the avatar.
|
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 |
getBlockSize()
Indicates how many pixels form a block in the game.
|
java.util.TreeSet<Event> |
getEventsHistory()
Returns the list of historic events happened in this game so far.
|
java.util.ArrayList<Observation>[] |
getFromAvatarSpPositions(Vector2d refPosition)
Returns a list of observations of objects created by the avatar's actions.
|
double |
getGameScore()
Gets the game score of this state.
|
int |
getGameTick()
Gets the current game tick of this particular state.
|
Types.WINNER |
getGameWinner()
Indicates if there is a game winner in the current observation.
|
java.util.ArrayList<Observation>[] |
getImmovablePositions(Vector2d refPosition)
Observations of static objects in the game.
|
java.util.ArrayList<Observation>[] |
getMovablePositions(Vector2d refPosition)
Returns a list with observations of sprites that move, but are NOT NPCs.
|
java.util.ArrayList<Observation>[] |
getNPCPositions(Vector2d refPosition)
Returns a list of observations of NPC in the game.
|
java.util.ArrayList<Observation>[][] |
getObservationGrid()
Returns a grid with all observations in the level.
|
java.util.ArrayList<Observation>[] |
getPortalsPositions(Vector2d refPosition) |
java.util.Random |
getRandomGenerator()
Returns the sampleRandom generator of this forward model.
|
java.util.ArrayList<Observation>[] |
getResourcesPositions(Vector2d refPosition) |
java.awt.Dimension |
getWorldDimension()
Returns the world dimensions, in pixels.
|
boolean |
isGameOver()
Indicates if the game is over or if it hasn't finished yet.
|
void |
printObservationGrid()
Prints the observation grid.
|
void |
removeSpriteObservation(VGDLSprite sprite)
Removes an sprite observation.
|
protected void |
tick(Types.ACTIONS action)
Performs one tick for the game: calling update(this) in all sprites.
|
void |
update(Game a_gameState)
Dumps the game state into 'this' object.
|
_updateCollisionDict, addSprite, addSprite, addSprite, checkTimeOut, clearAll, disqualify, eventHandling, getAvatar, getCharMapping, getCollisionEffects, getDefinedEffects, getDefinedEosEffects, getEosEffects, getNumSprites, getObservation, getResourceColor, getResourceLimit, getScreenSize, getSpriteGroup, getSpriteOrder, getSprites, getTerminations, getWinner, initForwardModel, initSprites, killSprite, parseParameters, playGame, reset, reverseDirection, runGame, setAvatar, setStochastic, terminationHandling, tick
public ForwardModel(Game a_gameState)
a_gameState
- public final void update(Game a_gameState)
a_gameState
- game to take the state from.public final void removeSpriteObservation(VGDLSprite sprite)
sprite
- sprite to remove.public void printObservationGrid()
public final java.util.Random getRandomGenerator()
getRandomGenerator
in class Game
protected void tick(Types.ACTIONS action)
action
- Action to be performed by the avatar for this game tick.public final void advance(Types.ACTIONS action)
action
- public final ForwardModel copy()
public double getGameScore()
public int getGameTick()
getGameTick
in class Game
public Types.WINNER getGameWinner()
public boolean isGameOver()
isGameOver
in class Game
public java.awt.Dimension getWorldDimension()
public int getBlockSize()
public Vector2d getAvatarPosition()
public double getAvatarSpeed()
public Vector2d getAvatarOrientation()
public java.util.ArrayList<Types.ACTIONS> getAvatarActions()
public java.util.HashMap<java.lang.Integer,java.lang.Integer> getAvatarResources()
public java.util.ArrayList<Observation>[][] getObservationGrid()
public java.util.TreeSet<Event> getEventsHistory()
public java.util.ArrayList<Observation>[] getNPCPositions(Vector2d refPosition)
refPosition
- Reference position to use when sorting this array,
by ascending distance to this point.public java.util.ArrayList<Observation>[] getImmovablePositions(Vector2d refPosition)
refPosition
- Reference position to use when sorting this array,
by ascending distance to this point.public java.util.ArrayList<Observation>[] getMovablePositions(Vector2d refPosition)
refPosition
- Reference position to use when sorting this array,
by ascending distance to this point.public java.util.ArrayList<Observation>[] getResourcesPositions(Vector2d refPosition)
public java.util.ArrayList<Observation>[] getPortalsPositions(Vector2d refPosition)
public java.util.ArrayList<Observation>[] getFromAvatarSpPositions(Vector2d refPosition)
refPosition
- Reference position to use when sorting this array,
by ascending distance to this point.public void buildLevel(java.lang.String gamelvl)
Game
buildLevel
in class Game
gamelvl
- file name containing the level.