public interface UnitController
| Modifier and Type | Method and Description |
|---|---|
boolean |
canEnlistAstronaut(Direction dir,
int oxygen,
CarePackage carePackage)
Returns if this unit can enlist an astronaut at a given direction, with a given quantity of oxygen, and equipped with a given carePackage (null if no care package).
|
boolean |
canPerformAction(ActionType action,
Direction dir,
int value)
Returns if a given action can be performed following the given direction with a particular numerical value (only used for JUMP action).
|
boolean |
canSenseLocation(Location loc)
Returns if the unit can sense target location.
|
void |
cleanBroadcastBuffer()
Erases all elements from the broadcast buffer.
|
void |
drawLineDebug(Location fromLoc,
Location toLoc,
int r,
int g,
int b)
Draws a segment on the map between a given pair of locations and with a given color scheme (in rgb-coordinates).
|
void |
drawPointDebug(Location loc,
int r,
int g,
int b)
Draws a point on the map at a given location and with a given color scheme (in rgb-coordinates).
|
void |
enlistAstronaut(Direction dir,
int oxygen,
CarePackage carePackage)
Attempts to enlist an astronaut at a given direction, with a given quantity of oxygen, and equipped with a given carePackage (null if no care package).
|
void |
eraseBroadcastBuffer(int n)
Erases the first n elements from the broadcast buffer.
|
AstronautInfo |
getAstronautInfo()
Returns the information about this unit if this unit is an astronaut.
|
int |
getEnergyLeft()
Returns this unit's remaining energy.
|
int |
getEnergyUsed()
Returns the energy used by this unit so far.
|
int |
getID()
Returns the ID of this unit.
|
Location |
getLocation()
Returns the location of this unit.
|
int |
getMapHeight()
Returns the height of the map.
|
int |
getMapWidth()
Returns the width of the map.
|
Team |
getOpponent()
Returns this unit's opponent.
|
StructureInfo |
getParent()
Returns the parent of this unit.
|
double |
getPercentageOfEnergyLeft()
Returns the fraction of remaining energy over this unit's total energy.
|
double |
getPercentageOfEnergyUsed()
Returns the percentage of this unit's total energy used so far.
|
double |
getRandomDouble()
Returns a randomly generated double.
|
int |
getRound()
Returns current game round.
|
StructureInfo |
getStructureInfo()
Returns the information about this unit if this unit is a structure.
|
Team |
getTeam()
Returns this unit's team.
|
StructureType |
getType()
Returns the type of this unit if this unit is a structure.
|
boolean |
isDomed(Location loc)
Returns true if the location is covered by a Dome.
|
boolean |
isOutOfMap(Location loc)
Returns if the given location is outside the map.
|
boolean |
isStructure()
Returns if this unit is a structure or not.
|
boolean |
isTerraformed(Location loc)
Returns true if the location is terraformed.
|
void |
killSelf()
This method kills this unit.
|
void |
performAction(ActionType action,
Direction dir,
int value)
Performs a given action following the given direction with a particular numerical value.
|
BroadcastInfo |
pollBroadcast()
Returns the front element of the broadcast buffer and removes that element from the buffer.
|
void |
println(java.lang.Object o)
Prints an object o for debug purposes.
|
AstronautInfo |
senseAstronaut(Location loc)
Returns the information of the astronaut at a given location.
|
AstronautInfo[] |
senseAstronauts(float radiusSquared,
Team team)
Returns an array with all other astronauts of a given team that can be sensed by this unit inside a given radius around it.
|
CarePackage |
senseCarePackage(Location loc)
Returns the information of the care package at a given location (null if none).
|
CarePackageInfo[] |
senseCarePackages(float radiusSquared)
Returns an array with the information of all care packages that can be sensed by this unit inside a given radius around it.
|
MapObject |
senseObjectAtLocation(Location loc)
Returns the information of the object at a given location.
|
Location[] |
senseObjects(MapObject mapObject,
float radiusSquared)
Returns an array with all visible objects inside the map and inside a given radius.
|
StructureInfo |
senseStructure(Location loc)
Returns the information of the structure at a given location.
|
StructureInfo[] |
senseStructures(float radiusSquared,
Team team)
Returns an array with all other structures of a given team that can be sensed by this unit inside a given radius around it.
|
TileType |
senseTileType(Location loc)
Returns the tile type (LAND, WATER or HOT_ZONE) at a given location.
|
void |
yield()
Halts this unit's execution until the next round.
|
AstronautInfo getAstronautInfo()
StructureInfo getStructureInfo()
boolean isStructure()
Location getLocation()
Team getTeam()
Team getOpponent()
StructureType getType()
int getMapHeight()
int getMapWidth()
int getID()
StructureInfo getParent()
boolean canSenseLocation(Location loc)
loc - Target location.boolean isOutOfMap(Location loc)
loc - Given locationMapObject senseObjectAtLocation(Location loc)
loc - Given locationLocation[] senseObjects(MapObject mapObject, float radiusSquared)
mapObject - Given objectradiusSquared - Given radius (squared)AstronautInfo senseAstronaut(Location loc)
loc - Given locationStructureInfo senseStructure(Location loc)
loc - Given locationAstronautInfo[] senseAstronauts(float radiusSquared, Team team)
radiusSquared - Given radius (squared)team - Given teamStructureInfo[] senseStructures(float radiusSquared, Team team)
radiusSquared - Given radius (squared)team - Given teamboolean isTerraformed(Location loc)
loc - Given locationboolean isDomed(Location loc)
loc - Given locationCarePackage senseCarePackage(Location loc)
loc - given location.CarePackageInfo[] senseCarePackages(float radiusSquared)
radiusSquared - Given radius (squared)TileType senseTileType(Location loc)
loc - Given locationvoid killSelf()
boolean canPerformAction(ActionType action, Direction dir, int value)
action - Action type.dir - Given direction (not used by BROADCAST action).value - Given numerical value (only used by JUMP action).void performAction(ActionType action, Direction dir, int value)
action - Action type.dir - Given direction.value - Given numerical value.boolean canEnlistAstronaut(Direction dir, int oxygen, CarePackage carePackage)
dir - Given directionoxygen - Given oxygencarePackage - Given care Packagevoid enlistAstronaut(Direction dir, int oxygen, CarePackage carePackage)
dir - Given directionoxygen - Given oxygencarePackage - Given care PackageBroadcastInfo pollBroadcast()
void cleanBroadcastBuffer()
void eraseBroadcastBuffer(int n)
n - Number of elements to be erased.int getRound()
int getEnergyUsed()
int getEnergyLeft()
double getPercentageOfEnergyLeft()
double getPercentageOfEnergyUsed()
void println(java.lang.Object o)
o - given object.void drawPointDebug(Location loc, int r, int g, int b)
loc - Given location.r - r-coordinateg - g-coordinateb - b-coordinatevoid drawLineDebug(Location fromLoc, Location toLoc, int r, int g, int b)
fromLoc - First location.toLoc - Second location.r - r-coordinateg - g-coordinateb - b-coordinatedouble getRandomDouble()
void yield()