public interface RobotController
RobotPlayer is
constructed, it is passed an instance of RobotController that
controls the newly created robot.| Modifier and Type | Method and Description |
|---|---|
void |
addMatchObservation(String observation)
Adds a custom observation to the match file, such that when it is analyzed, this observation will appear.
|
void |
attackLocation(MapLocation loc)
Queues an attack on the given location to be performed at the end of this turn.
|
void |
breakpoint()
If breakpoints are enabled, calling this method causes the game engine to
pause execution at the end of this round, until the user decides to
resume execution.
|
void |
broadcast(int channel,
int data)
Broadcasts a message to the global message board.
|
void |
build(Direction dir,
RobotType type)
Builds a structure in the given direction, queued for the end of the turn.
|
boolean |
canAttackLocation(MapLocation loc)
Returns whether the given location is within the robot's attack range.
|
boolean |
canBuild(Direction dir,
RobotType type)
Returns whether the robot can build a structure of the given type in the given direction, without taking delays into account.
|
boolean |
canLaunch(Direction dir)
Returns whether the direction is valid for launching (LAUNCHER only).
|
boolean |
canMine()
Returns whether the robot is able to mine, without taking delays into account.
|
boolean |
canMove(Direction dir)
Tells whether this robot can move in the given direction, without taking any sort of delays into account.
|
boolean |
canSenseLocation(MapLocation loc)
Returns true if the given location is within the robot's sensor range, or within the sensor range of some ally.
|
boolean |
canSenseRobot(int id)
Returns true if the given robot is within the robot's sensor range.
|
boolean |
canSpawn(Direction dir,
RobotType type)
Returns whether the spawn action is valid, without taking delays into account.
|
void |
castFlash(MapLocation loc)
Casts Flash at the given location (COMMANDER only).
|
DependencyProgress |
checkDependencyProgress(RobotType type)
Gets the current progress of a dependency (relevant for building structures).
|
void |
disintegrate()
Kills your robot and ends the current round.
|
void |
explode()
Attacks all surrounding enemies (MISSILE only).
|
long |
getControlBits()
Gets this robot's 'control bits' for debugging purposes.
|
double |
getCoreDelay()
Returns the amount of core delay a robot has accumulated.
|
int |
getFlashCooldown()
Returns the current cooldown of FLASH (COMMANDER only).
|
double |
getHealth()
Gets the robot's current health.
|
int |
getID()
Use this method to access your ID.
|
MapLocation |
getLocation()
Gets the robot's current location.
|
int |
getMissileCount()
Returns how many missiles the robot has.
|
int |
getRoundLimit()
Gets the number of rounds in the game.
|
double |
getSupplyLevel()
Gets the robot's current supply level.
|
Team |
getTeam()
Gets the Team of this robot.
|
long[] |
getTeamMemory()
Returns the team memory from the last game of the match.
|
double |
getTeamOre()
Gets the team's total ore.
|
RobotType |
getType()
Gets this robot's type (SOLDIER, HQ, etc.).
|
double |
getWeaponDelay()
Returns the amount of weapon delay a robot has accumulated.
|
int |
getXP()
Gets the experience a robot has.
|
boolean |
hasBuildRequirements(RobotType type)
Returns whether you have the ore and the dependencies to build the given robot, and that the robot can build structures.
|
boolean |
hasCommander()
Returns whether the team currently has a commander.
|
boolean |
hasLearnedSkill(CommanderSkillType skill)
Returns whether the robot has learned a skill (only relevant if used by a COMMANDER).
|
boolean |
hasSpawnRequirements(RobotType type)
Checks to make sure you have the ore requirements to spawn, and that the structure can actually spawn the specified RobotType.
|
boolean |
isBuildingSomething()
Returns whether this robot is currently building anything.
|
boolean |
isCoreReady()
Returns whether the core delay is strictly less than 1 (whether the robot can perform a core action in the given turn).
|
boolean |
isLocationOccupied(MapLocation loc)
Returns whether there is a robot at the given location.
|
boolean |
isPathable(RobotType type,
MapLocation loc)
Returns whether a robot of the given type can move into the given location, without taking any sort of delays into account.
|
boolean |
isWeaponReady()
Returns whether the weapon delay is less than 1 (whether the robot can attack in the given turn).
|
void |
launchMissile(Direction dir)
Launches a missile in the given direction (LAUNCHER only).
|
void |
mine()
Mines the current square for ore.
|
void |
move(Direction dir)
Queues a move in the given direction to be performed at the end of this turn.
|
int |
readBroadcast(int channel)
Retrieves the message stored at the given radio channel.
|
void |
resign()
Causes your team to lose the game.
|
MapLocation |
senseEnemyHQLocation()
Returns location of the enemy team's HQ (unconstrained by sensor range or distance).
|
MapLocation[] |
senseEnemyTowerLocations()
Returns the locations of surviving enemy towers, unconstrained by sensor range or distance.
|
MapLocation |
senseHQLocation()
Returns location of the allied team's HQ (unconstrained by sensor range or distance).
|
RobotInfo[] |
senseNearbyRobots()
Returns all robots that can be sensed on the map.
|
RobotInfo[] |
senseNearbyRobots(int radiusSquared)
Returns all robots that can be sensed within a certain radius of the robot.
|
RobotInfo[] |
senseNearbyRobots(int radiusSquared,
Team team)
Returns all robots of a given team that can be sensed within a certain radius of the robot.
|
RobotInfo[] |
senseNearbyRobots(MapLocation center,
int radiusSquared,
Team team)
Returns all robots of a givin team that can be sensed within a certain radius of a specified location.
|
double |
senseOre(MapLocation loc)
Returns the amount of ore at a given location (to within sensor capabilities).
|
RobotInfo |
senseRobot(int id)
Senses information about a particular robot given its ID.
|
RobotInfo |
senseRobotAtLocation(MapLocation loc)
Returns the robot at the given location, or
null
if there is no object there. |
TerrainTile |
senseTerrainTile(MapLocation loc)
Senses the terrain at the given location.
|
MapLocation[] |
senseTowerLocations()
Returns the locations of your own towers, unconstrained by sensor range or distance.
|
void |
setIndicatorDot(MapLocation loc,
int red,
int green,
int blue)
Draws a dot on the game map, for debugging purposes.
|
void |
setIndicatorLine(MapLocation from,
MapLocation to,
int red,
int green,
int blue)
Draws a line on the game map, for debugging purposes.
|
void |
setIndicatorString(int stringIndex,
String newString)
Sets one of this robot's 'indicator strings' for debugging purposes.
|
void |
setTeamMemory(int index,
long value)
Sets the team's "memory", which is saved for the next game in the
match.
|
void |
setTeamMemory(int index,
long value,
long mask)
Sets this team's "memory".
|
void |
spawn(Direction dir,
RobotType type)
Queues a spawn action to be performed at the end of this robot's turn.
|
void |
transferSupplies(int amount,
MapLocation loc)
Transfers supplies to a robot in a nearby location (queued for the end of the turn).
|
void |
yield()
Ends the current round.
|
int getRoundLimit()
double getTeamOre()
int getID()
Team getTeam()
RobotType getType()
MapLocation getLocation()
double getCoreDelay()
double getWeaponDelay()
double getHealth()
double getSupplyLevel()
int getXP()
int getMissileCount()
boolean isBuildingSomething()
MapLocation senseHQLocation()
MapLocation senseEnemyHQLocation()
MapLocation[] senseTowerLocations()
MapLocation[] senseEnemyTowerLocations()
TerrainTile senseTerrainTile(MapLocation loc)
loc - the location to check.boolean canSenseLocation(MapLocation loc)
loc - the location to check.boolean isLocationOccupied(MapLocation loc) throws GameActionException
loc - the location to check.GameActionException - if loc is not within sensor range (CANT_SENSE_THAT).RobotInfo senseRobotAtLocation(MapLocation loc) throws GameActionException
null
if there is no object there.loc - the location to check.GameActionException - if loc is not within sensor range (CANT_SENSE_THAT).boolean canSenseRobot(int id)
id - the ID of the robot to query.RobotInfo senseRobot(int id) throws GameActionException
id - the ID of the robot to query.GameActionException - if the robot cannot be sensed (for example, if it doesn't exist or is out of sight range).RobotInfo[] senseNearbyRobots()
RobotInfo[] senseNearbyRobots(int radiusSquared)
radiusSquared - return objects this distance away from the center.RobotInfo[] senseNearbyRobots(int radiusSquared, Team team)
radiusSquared - return objects this distance away from the center.team - filter game objects by the given team. If null is passed, objects from all teams are returned.RobotInfo[] senseNearbyRobots(MapLocation center, int radiusSquared, Team team)
center - center of the given search radius.radiusSquared - return objects this distance away from the center.team - filter game objects by the given team. If null is passed, objects from all teams are returned.boolean isCoreReady()
boolean isWeaponReady()
boolean isPathable(RobotType type, MapLocation loc)
type - the type of the robot.loc - the location to test.boolean canMove(Direction dir)
dir - the direction to move in.void move(Direction dir) throws GameActionException
dir - the direction to move in.GameActionException - if the robot cannot move in this direction.boolean canAttackLocation(MapLocation loc)
loc - the location to attempt to attack.void attackLocation(MapLocation loc) throws GameActionException
loc - the location to attack.GameActionException - if the robot cannot attack the given square.void explode()
throws GameActionException
GameActionException - if the robot cannot explode.boolean hasCommander()
void castFlash(MapLocation loc) throws GameActionException
loc - the target location.GameActionException - if the robot has not learned the spell or cannot cast at the given square.boolean hasLearnedSkill(CommanderSkillType skill) throws GameActionException
skill - the skill being checked.GameActionException - if there is no commander.int getFlashCooldown()
throws GameActionException
GameActionException - if there is no commander.void broadcast(int channel,
int data)
throws GameActionException
channel - the channel to write to, from 0 to BROADCAST_MAX_CHANNELS.data - one int's worth of data to write.GameActionException - if the channel is invalid.int readBroadcast(int channel)
throws GameActionException
channel - radio channel to query, from 0 to BROADCAST_MAX_CHANNELS.GameActionException - if the channel is invalid.void transferSupplies(int amount,
MapLocation loc)
throws GameActionException
amount - the amount of supply to transfer.loc - the location to transfer the supply to.GameActionException - if there is no one to transfer to, or if the distance is too far for a supply transfer.boolean canMine()
double senseOre(MapLocation loc)
loc - the MapLocation to sense ore at.void mine()
throws GameActionException
GameActionException - if the current robot is not one that can collect oreGameActionException - if there is currently movement delay and if the robot cannot mineboolean canLaunch(Direction dir)
dir - the direction to check.void launchMissile(Direction dir) throws GameActionException
dir - the direction to launch a missile.GameActionException - if not enough missiles or otherwise can't attack.DependencyProgress checkDependencyProgress(RobotType type)
type - the dependency to check.boolean hasSpawnRequirements(RobotType type)
type - the type to check.boolean canSpawn(Direction dir, RobotType type)
dir - the direction to spawn in.type - the type to spawn.void spawn(Direction dir, RobotType type) throws GameActionException
dir - the direction to spawn the robot in.type - the robot type to spawn.GameActionException - if the spawn is bad.boolean hasBuildRequirements(RobotType type)
type - the type to build.boolean canBuild(Direction dir, RobotType type)
dir - the direction to build in.type - the robot type to spawn.void build(Direction dir, RobotType type) throws GameActionException
dir - the direction to bulid in.type - the type to build.GameActionException - if the build is bad.void yield()
void disintegrate()
void resign()
void setTeamMemory(int index,
long value)
GameConstants.TEAM_MEMORY_LENGTH
longs. If this method is called more than once with the same index
in the same game, the last call is what is saved for the
next game.index - the index of the array to set.value - the data that the team should remember for the next game.ArrayIndexOutOfBoundsException - if index is less
than zero or greater than or equal to GameConstants.TEAM_MEMORY_LENGTH.getTeamMemory(),
setTeamMemory(int, long, long)void setTeamMemory(int index,
long value,
long mask)
setTeamMemory(int, long) provides. For example,
if mask == 0xFF then only the eight least significant bits of
the memory will be set.index - the index of the array to set.value - the data that the team should remember for the next game.mask - indicates which bits should be set.ArrayIndexOutOfBoundsException - if index is less
than zero or greater than or equal to GameConstants.TEAM_MEMORY_LENGTH.getTeamMemory(),
setTeamMemory(int, long)long[] getTeamMemory()
GameConstants.TEAM_MEMORY_LENGTH.
If setTeamMemory was not called in the last game, or there was no last game, the
corresponding long defaults to 0.setTeamMemory(int, long),
setTeamMemory(int, long, long)void setIndicatorString(int stringIndex,
String newString)
stringIndex - the index of the indicator string to set. Must be between 0 and GameConstants.NUMBER_OF_INDICATOR_STRINGS.newString - the value to which the indicator string should be set.void setIndicatorDot(MapLocation loc, int red, int green, int blue)
loc - the location to draw the dot.red - the red component of the dot's color.green - the green component of the dot's color.blue - the blue component of the dot's color.void setIndicatorLine(MapLocation from, MapLocation to, int red, int green, int blue)
from - the location to draw the line from.to - the location to draw the line to.red - the red component of the line's color.green - the green component of the line's color.blue - the blue component of the line's color.long getControlBits()
void addMatchObservation(String observation)
observation - the observation you want to inject into the match file.void breakpoint()