WorldAPI Interface Reference
Inheritance diagram for WorldAPI:

Public Member Functions

Robot.AttackResult meleeAttack (int power, Robot.GridCell adjacent_cell) throws RoboSim.RoboSimExecutionException
 
Robot.AttackResult rangedAttack (int power, Robot.GridCell nonadjacent_cell) throws RoboSim.RoboSimExecutionException
 
Robot.AttackResult capsuleAttack (int power_of_capsule, Robot.GridCell cell) throws RoboSim.RoboSimExecutionException
 
void defend (int power) throws RoboSim.RoboSimExecutionException
 
void move (int steps, Robot.Direction way) throws RoboSim.RoboSimExecutionException
 
void pick_up_capsule (Robot.GridCell adjacent_cell) throws RoboSim.RoboSimExecutionException
 
void drop_capsule (Robot.GridCell adjacent_cell, int power_of_capsule) throws RoboSim.RoboSimExecutionException
 
Robot.BuildStatus getBuildStatus () throws RoboSim.RoboSimExecutionException
 
Robot.GridCell getBuildTarget () throws RoboSim.RoboSimExecutionException
 
int getInvestedBuildPower () throws RoboSim.RoboSimExecutionException
 
void setBuildTarget (Robot.BuildStatus status, Robot.GridCell location) throws RoboSim.RoboSimExecutionException
 
void setBuildTarget (Robot.BuildStatus status, Robot.GridCell location, byte[] creation_message) throws RoboSim.RoboSimExecutionException
 
void build (int power) throws RoboSim.RoboSimExecutionException
 
void repair (int power) throws RoboSim.RoboSimExecutionException
 
void charge (int power, Robot.GridCell ally) throws RoboSim.RoboSimExecutionException
 
void sendMessage (byte[] message, int power) throws RoboSim.RoboSimExecutionException
 
Robot.GridCell[][] getVisibleNeighborhood ()
 
Robot.GridCell[][] getWorld (int power) throws RoboSim.RoboSimExecutionException
 
void scanEnemy (Robot.Robot_Specs enemySpecs, Robot.Robot_Status enemyStatus, Robot.GridCell toScan) throws RoboSim.RoboSimExecutionException
 

Detailed Description

WorldAPI Interface:
Provides callbacks into Simulator so your Robot can take actions in the virtual world.
The underlying class type is an inner class defined inside the simulator which is opaque to your robot.

Definition at line 8 of file WorldAPI.java.

Member Function Documentation

void WorldAPI.build ( int  power) throws RoboSim.RoboSimExecutionException
Parameters
powerhow much power to apply to building the current target. Must not be more than remaining power needed to finish building target.

Implemented in RoboSim.RoboAPIImplementor.

Robot.AttackResult WorldAPI.capsuleAttack ( int  power_of_capsule,
Robot.GridCell  cell 
) throws RoboSim.RoboSimExecutionException

Capsule attack: attack with a capsule

Parameters
power_of_capsulepower of the capsule to use in the attack
cellGridCell (may be adjacent or nonadjacent) to attack

Implemented in RoboSim.RoboAPIImplementor.

void WorldAPI.charge ( int  power,
Robot.GridCell  ally 
) throws RoboSim.RoboSimExecutionException

Spend power to charge an adjacent ally robot. 1-for-1 efficiency.

Parameters
poweramount of power to use for charging ally
allycell containing ally to charge. Must be adjacent.

Implemented in RoboSim.RoboAPIImplementor.

void WorldAPI.defend ( int  power) throws RoboSim.RoboSimExecutionException

Defend: increase defense

Parameters
powerpower to use for defense (may not exceed defense skill)

Implemented in RoboSim.RoboAPIImplementor.

void WorldAPI.drop_capsule ( Robot.GridCell  adjacent_cell,
int  power_of_capsule 
) throws RoboSim.RoboSimExecutionException

drop_capsule: drop a capsule (for an ally to pick up, presumably)

Parameters
adjacent_cellwhere to drop capsule (must be adjacent)
power_of_capsulehow powerful a capsule to drop

Implemented in RoboSim.RoboAPIImplementor.

Robot.BuildStatus WorldAPI.getBuildStatus ( ) throws RoboSim.RoboSimExecutionException

Tells us what we're in the middle of building.

Returns
BuildStatus object indicating what we're building. Is null if we're not building anything.

Implemented in RoboSim.RoboAPIImplementor.

Robot.GridCell WorldAPI.getBuildTarget ( ) throws RoboSim.RoboSimExecutionException
Returns
GridCell indicating the target of our building efforts. Is null if we're not building anything.

Implemented in RoboSim.RoboAPIImplementor.

int WorldAPI.getInvestedBuildPower ( ) throws RoboSim.RoboSimExecutionException
Returns
how much we've invested in our current build target.

Implemented in RoboSim.RoboAPIImplementor.

Robot.GridCell [][] WorldAPI.getVisibleNeighborhood ( )

Gets a copy of the portion of the world visible to the robot. Range is equal to defense skill. Does not cost any power.

Returns
a 2-dimensional array containing a GridCell for each cell visible to the robot.

Implemented in RoboSim.RoboAPIImplementor.

Referenced by ManualBot.act().

Here is the caller graph for this function:

Robot.GridCell [][] WorldAPI.getWorld ( int  power) throws RoboSim.RoboSimExecutionException

Gets a copy of the entire world. Takes 3 power, plus additional if jamming is taking place (which won't be; jamming is not implemented).

Parameters
powerto spend attempting to get the world
Returns
a 2-dimensional array containing a GridCell for each cell in the world. Will be null if jamming has prevented the world from being retrieved.

Implemented in RoboSim.RoboAPIImplementor.

Robot.AttackResult WorldAPI.meleeAttack ( int  power,
Robot.GridCell  adjacent_cell 
) throws RoboSim.RoboSimExecutionException

Melee attack: attack an adjacent grid cell

Parameters
powerPower to use for attack (may not exceed attack skill)
adjacent_cellAdjacent GridCell to attack
Returns
AttackResult indicating whether attack succeeded and/or destroyed target of attack.

Implemented in RoboSim.RoboAPIImplementor.

Referenced by ManualBot.act().

Here is the caller graph for this function:

void WorldAPI.move ( int  steps,
Robot.Direction  way 
) throws RoboSim.RoboSimExecutionException

move: move robot

Parameters
stepshow far to move
waywhich way to move

Implemented in RoboSim.RoboAPIImplementor.

Referenced by ManualBot.act().

Here is the caller graph for this function:

void WorldAPI.pick_up_capsule ( Robot.GridCell  adjacent_cell) throws RoboSim.RoboSimExecutionException

pick_up_capsule: pick up a capsule

Parameters
adjacent_cellGridCell where capsule is that you want to pick up (must be adjacent)

Implemented in RoboSim.RoboAPIImplementor.

Robot.AttackResult WorldAPI.rangedAttack ( int  power,
Robot.GridCell  nonadjacent_cell 
) throws RoboSim.RoboSimExecutionException

Ranged attack: attack nonadjacent grid cell within certain range

Parameters
powerPower to use for attack (may not exceed attack skill)
nonadjacent_cellnon-adjacent GridCell to attack
Returns
AttackResult indicating whether attack succeeded and/or destroyed target of attack.

Implemented in RoboSim.RoboAPIImplementor.

Referenced by ManualBot.act().

Here is the caller graph for this function:

void WorldAPI.repair ( int  power) throws RoboSim.RoboSimExecutionException

Spend power to repair yourself. 2 power restores 1 health.

Parameters
poweramount of power to spend on repairs. Should be even.

Implemented in RoboSim.RoboAPIImplementor.

void WorldAPI.scanEnemy ( Robot.Robot_Specs  enemySpecs,
Robot.Robot_Status  enemyStatus,
Robot.GridCell  toScan 
) throws RoboSim.RoboSimExecutionException

Scans an enemy (or ally), retrieving information about the robot. The cell scanned must be visible (within defense cells from us).
Takes 1 power.

Parameters
enemySpecsempty Robot_Specs object to be filled in
enemyStatusempty Robot_Status object to be filled in
toScancell containing robot we want to scan

Implemented in RoboSim.RoboAPIImplementor.

void WorldAPI.sendMessage ( byte[]  message,
int  power 
) throws RoboSim.RoboSimExecutionException

Spend additional power to get radio messages unavailable because of jamming.

Parameters
poweramount of power to spend to attempt to overcome jamming
Returns
messages received after additional power spent. Will include all messages included in simulator's call to act(). May be null if no messages were received. Sends a message to an ally or allies.
Parameters
message64-byte array containing message to transmit
poweramount of power to use for sending message

Implemented in RoboSim.RoboAPIImplementor.

void WorldAPI.setBuildTarget ( Robot.BuildStatus  status,
Robot.GridCell  location 
) throws RoboSim.RoboSimExecutionException

Tells the simulator the robot is beginning to build something in an adjacent cell (or, for capsules, inside itself).
In order to mark a capsule or robot as "done", call this method with both parameters null. This will destroy any in-progress build.

Note that you must not move from your current cell while in the process of building anything other than a capsule. If you do, you will lose any in-progress work on a wall or fort, and a robot will be automatically finalized with however many skill points you've invested up to that point.

Parameters
statuswhat we're going to start building (or, in the case of an energy capsule, resume building)
locationwhere to direct our building efforts. Must be an adjacent, empty location, or null if status=capsule.

Implemented in RoboSim.RoboAPIImplementor.

void WorldAPI.setBuildTarget ( Robot.BuildStatus  status,
Robot.GridCell  location,
byte[]  creation_message 
) throws RoboSim.RoboSimExecutionException

Tells the simulator the robot is beginning to build something in an adjacent cell (or, for capsules, inside itself).
In order to mark a capsule or robot as "done", call this method with both parameters null. This will destroy any in-progress build.

Note that you must not move from your current cell while in the process of building anything other than a capsule. If you do, you will lose any in-progress work on a wall or fort, and a robot will be automatically finalized with however many skill points you've invested up to that point.

Parameters
statuswhat we're going to start building (or, in the case of an energy capsule, resume building)
locationwhere to direct our building efforts. Must be an adjacent, empty location, or null if status=capsule.
creation_messagemessage to send to newly created robot (if we're finalizing one)

Implemented in RoboSim.RoboAPIImplementor.


The documentation for this interface was generated from the following file: