Class Entities
java.lang.Object
ch.idsia.agents.controllers.modules.Entities
public class Entities
extends java.lang.Object
An
Entities object provides information about entities around Mario.
In methods in this class, (mapX, mapY) are tile coordinates in the receptive field. In these coordinates, (0,0) is at the upper-left corner of the receptive field.
(relMapX, relMapY) are tile coordinates relative to Mario. In these coordinates, (0, 0) is Mario's position.
-
Field Summary
Fields Modifier and Type Field Description java.util.List<Entity>entitiesA list of all entities within Mario's receptive field.java.util.List<Entity>[][]entityFieldA 2-dimensional array of entities in the receptive field. -
Constructor Summary
Constructors Constructor Description Entities() -
Method Summary
Modifier and Type Method Description booleananything(int relMapX, int relMapY)Is there any entity at (relMapX, relMapY)?booleancollectible(int relMapX, int relMapY)Can I collect something at (relMapX, relMapY)?booleandanger(int relMapX, int relMapY)Is there anything dangerous at (relMapX, relMapY)?java.util.List<Entity>entities(int relMapX, int relMapY)Returns all entities at (relMapX, relMapY).EntityTypeentityType(int relMapX, int relMapY)Return the most dangerous entity type at (relMapX, relMapY).protected java.util.List<Entity>getEntities(int mapX, int mapY)Return all entities at (mapX, mapY).protected EntityTypegetEntityType(int mapX, int mapY)Returns the most dangerous entity type at (mapX, mapY).static booleanisCollectible(Entity entity)Is this entity collectible?static booleanisDanger(Entity entity)Return true if this entity is dangerous.static booleanisShootable(Entity entity)Is this entity shootable by fireball?static booleanisSquishy(Entity entity)Is this entity squishable by jumping on it (== destroyable)?booleannothing(int relMapX, int relMapY)Is there no entity at (relMapX, relMapY)?voidreset(AgentOptions options)booleanshootable(int relMapX, int relMapY)Can I shoot something at (relMapX, relMapY)?booleansquishy(int relMapX, int relMapY)Return true if Mario can squish something at (relMapX, relMapY).
-
Field Details
-
entityField
A 2-dimensional array of entities in the receptive field.Entities are indexed by row, then column: entityField[mapY, mapX] is the entity at (mapX, mapY).
Mario is at [marioEgoRow][marioEgoCol].
The array is
#receptiveFieldHeightx#receptiveFieldWidthin size. -
entities
A list of all entities within Mario's receptive field.
-
-
Constructor Details
-
Entities
public Entities()
-
-
Method Details
-
reset
-
getEntityType
Returns the most dangerous entity type at (mapX, mapY). The most dangerous entity is the one with the lowestEntityKind.getThreatLevel().- Parameters:
mapX- absolute receptive field tile x-coordinatemapY- absolute receptive field tile y-coordinate
-
getEntities
Return all entities at (mapX, mapY).- Parameters:
mapX- absolute receptive field tile x-coordinatemapY- absolute receptive field tile y-coordinate
-
entityType
Return the most dangerous entity type at (relMapX, relMapY). The most dangerous entity is the one with the lowestEntityKind.getThreatLevel(). -
entities
Returns all entities at (relMapX, relMapY). -
anything
public boolean anything(int relMapX, int relMapY)Is there any entity at (relMapX, relMapY)? -
nothing
public boolean nothing(int relMapX, int relMapY)Is there no entity at (relMapX, relMapY)? -
danger
public boolean danger(int relMapX, int relMapY)Is there anything dangerous at (relMapX, relMapY)? -
isDanger
Return true if this entity is dangerous. -
squishy
public boolean squishy(int relMapX, int relMapY)Return true if Mario can squish something at (relMapX, relMapY). Note that this will return FALSE if there is non-squishable dangerous stuff there. -
isSquishy
Is this entity squishable by jumping on it (== destroyable)? -
shootable
public boolean shootable(int relMapX, int relMapY)Can I shoot something at (relMapX, relMapY)?If the tile is occupied by both shootable and non-shootable entities, this will return FALSE (to play safe).
-
isShootable
Is this entity shootable by fireball? -
collectible
public boolean collectible(int relMapX, int relMapY)Can I collect something at (relMapX, relMapY)?This will only return true if there is also nothing dangerous at that position.
-
isCollectible
Is this entity collectible?
-