public interface UnitController
| Modifier and Type | Method and Description |
|---|---|
void |
attack(Location loc)
Orders this unit to attack the given location.
|
void |
buildFarm(Direction dir)
Orders this unit to build a farm following the given direciton.
|
boolean |
canAttack()
Returns if this unit can attack this turn.
|
boolean |
canAttack(Location loc)
Returns if this unit can attack the given location.
|
boolean |
canBuildFarm(Direction dir)
Returns if the unit can build a farm following the given direction.
|
boolean |
canDeposit()
Returns true if this unit can deposit food on an adjacent base or market.
|
boolean |
canDonate(int amount)
Returns if this unit can donate the given amount of toilet paper for the vaccine development.
|
boolean |
canGatherFood()
Returns if this unit can gather the food in a 3x3 area around this unit.
|
boolean |
canMove()
Returns if this unit can move this turn.
|
boolean |
canMove(Direction direction)
Returns if this unit can move following the given direction.
|
boolean |
canPerformPCR()
Returns if this unit can perform a PCR test.
|
boolean |
canSenseLocation(Location loc)
Returns if the given location is inside this unit's vision range.
|
boolean |
canSpawn(UnitType type,
Direction dir)
Returns if this unit can spawn a unit of the given type following the given direction.
|
void |
deposit()
Orders this unit to deposit food on an adjacent base or market.
|
void |
donate(int amount)
Donates the desired amount for the vaccine development.
|
void |
drawLine(Location loc1,
Location loc2,
int r,
int g,
int b)
Draws a line of a given color between the given locations.
|
void |
drawPoint(Location loc,
int r,
int g,
int b)
Draws a point of a given color at a given location.
|
void |
gatherFood()
Orders this unit to gather food in a 3x3 area around it.
|
int |
getEnergyLeft()
Returns the amount of remaining energy.
|
int |
getEnergyUsed()
Returns the amount of energy used so far this turn.
|
int |
getFoodCarried()
Returns the food carried by this unit.
|
UnitInfo |
getInfo()
Returns the information about this unit.
|
Location |
getInitialLocation(Team team)
Returns the initial location of a given team.
|
Location |
getLocation()
Returns the location of this unit.
|
Team |
getOpponent()
Returns the opposing team.
|
double |
getPercentageOfEnergyLeft()
Returns the percentage of energy used so far this turn.
|
double |
getPercentageOfEnergyUsed()
Returns the percentage of remaining energy.
|
int |
getRound()
Returns the current round number.
|
Team |
getTeam()
Returns this unit's team.
|
int |
getToiletPaper()
Returns the amount of toilet paper available for the team.
|
UnitType |
getType()
Retruns this unit's type.
|
Location[] |
getVisibleLocations()
Returns an array with all visible locations inside the map.
|
Location[] |
getVisibleLocations(int radiusSquared)
Returns an array of all visible locations inside a given radius (squared) and inside the map.
|
boolean |
isAccessible(Location loc)
Returns if this unit can acces the given location.
|
boolean |
isCity(Location loc)
Returns if there's a city at the given location.
|
boolean |
isInfected()
Returns if this unit has symptoms of the virus.
|
boolean |
isObstructed(Location loc1,
Location loc2)
Returns if there is any obstacle such that its interior intersects the segment between the given locations.
|
boolean |
isOutOfMap(Location loc)
Returns if a given location is out of the map.
|
boolean |
isStronglyInfected(Location loc)
Returns if the given location is strongly infected.
|
void |
move(Direction direction)
Orders this unit to move following the given direction.
|
boolean |
performPCR()
Returns the result of the PCR test.
|
void |
println(java.lang.Object o)
Writes the given object for debugging purposes.
|
int |
read(int i)
Returns the value written at the given location of the communication array.
|
Location[] |
senseCities()
Returns an array with the location of all visible cities.
|
Location[] |
senseCities(int radiusSquared)
Returns an array with the location of all visible cities inside a given radius around this unit.
|
FarmInfo |
senseFarmAtLocation(Location loc)
Returns the information about the farm at the given location.
|
FarmInfo[] |
senseFarms()
Returns an array with the information about all farms which are visible by this unit.
|
FarmInfo[] |
senseFarms(int radiusSquared)
Returns an array with the information about all visible farms inside a given radius (squared) around this unit.
|
Location[] |
senseObstacles()
Returns an array with the location of all visible obstacles.
|
Location[] |
senseObstacles(int radiusSquared)
Returns an array with the location of all visible obstacles inside a given radius around this unit.
|
UnitInfo |
senseUnitAtLocation(Location loc)
Returns the information about the unit at the given location.
|
UnitInfo[] |
senseUnits()
Returns an array with the information of all visible units.
|
UnitInfo[] |
senseUnits(int radiusSquared)
Returns an array with the information of all visible units inside a given radius around this unit.
|
UnitInfo[] |
senseUnits(int radiusSquared,
Team team,
boolean complementary,
boolean includeNeutral)
Returns an array with the information of all visible units of a given team inside a given radius around this unit.
|
UnitInfo[] |
senseUnits(Team team)
Returns an array with the information of all visible units of a given team.
|
UnitInfo[] |
senseUnits(Team team,
boolean complementary,
boolean includeNeutral)
Returns an array with the information of all visible units of a given team.
|
void |
spawn(UnitType type,
Direction dir)
Orders this unit to spawn a unit of a given type following the given direction.
|
int |
toiletPaperDonated()
Returns the amount of toilet paper donated for the vaccine development.
|
boolean |
vaccinated()
Returns if this unit is vaccinated or not.
|
void |
write(int i,
int val)
Writes a given value at a given location of the communication array.
|
void |
yield()
Ends the turn.
|
UnitInfo getInfo()
Location getLocation()
Team getTeam()
Team getOpponent()
Location getInitialLocation(Team team)
team - Given team.boolean isInfected()
boolean canPerformPCR()
boolean performPCR()
int getFoodCarried()
boolean canDonate(int amount)
amount - Given amount.void donate(int amount)
amount - Desired amount.int toiletPaperDonated()
boolean vaccinated()
boolean canMove()
boolean canAttack()
boolean canMove(Direction direction)
direction - Given direction.void move(Direction direction)
direction - Given direction.boolean isObstructed(Location loc1, Location loc2)
loc1 - First location.loc2 - Second location.boolean canAttack(Location loc)
loc - Given location.void attack(Location loc)
loc - Given location.boolean canSenseLocation(Location loc)
loc - Given location.FarmInfo senseFarmAtLocation(Location loc)
loc - Given location.boolean isCity(Location loc)
loc - Posicio objectiu.boolean isOutOfMap(Location loc)
loc - Given location.Location[] getVisibleLocations(int radiusSquared)
radiusSquared - Given radius (squared).UnitInfo senseUnitAtLocation(Location loc)
loc - Given location.FarmInfo[] senseFarms(int radiusSquared)
radiusSquared - Given radius (squared).FarmInfo[] senseFarms()
Location[] senseCities(int radiusSquared)
radiusSquared - Given radius (squared).Location[] senseCities()
Location[] senseObstacles(int radiusSquared)
radiusSquared - Given radius (squared).Location[] senseObstacles()
UnitInfo[] senseUnits(int radiusSquared)
radiusSquared - Given radius (squared).UnitInfo[] senseUnits(int radiusSquared, Team team, boolean complementary, boolean includeNeutral)
radiusSquared - Given radius (squared).team - Given team (squared).radiusSquared - Given radius (squared).team - Given team.complementary - If true, it returns the units that are not from the given team instead.includeNeutral - If false, it does not include neutral units.UnitInfo[] senseUnits(Team team, boolean complementary, boolean includeNeutral)
team - Given team.complementary - If true, it returns the units that are not from the given team instead.includeNeutral - If false, it does not include neutral units.UnitInfo[] senseUnits()
UnitInfo[] senseUnits(Team team)
team - Given team.Location[] getVisibleLocations()
boolean canSpawn(UnitType type, Direction dir)
type - Given type.dir - Given direction.void spawn(UnitType type, Direction dir)
type - Given type.dir - Given direction.boolean canBuildFarm(Direction dir)
dir - Given direction.void buildFarm(Direction dir)
dir - Given direction.UnitType getType()
boolean canGatherFood()
void gatherFood()
boolean canDeposit()
void deposit()
boolean isAccessible(Location loc)
loc - Given location.boolean isStronglyInfected(Location loc)
loc - Given location.int getRound()
int getEnergyUsed()
int getEnergyLeft()
double getPercentageOfEnergyLeft()
double getPercentageOfEnergyUsed()
void write(int i,
int val)
i - Array location.val - Value.int read(int i)
i - Array location.void println(java.lang.Object o)
o - Object.void drawPoint(Location loc, int r, int g, int b)
loc - Given location.r - r-Coordinate of the color.b - b-Coordinate of the color.g - g-Coordinate of the color.void drawLine(Location loc1, Location loc2, int r, int g, int b)
loc1 - First location.loc2 - Second location.r - r-Coordinate of the color.b - b-Coordinate of the color.g - g-Coordinate of the color.int getToiletPaper()
void yield()