WorldAPI Class Referenceabstract

#include <WorldAPI.hpp>

Inheritance diagram for WorldAPI:

Public Member Functions

virtual AttackResult meleeAttack (int power, GridCell &adjacent_cell)=0
 
virtual AttackResult rangedAttack (int power, GridCell &nonadjacent_cell)=0
 
virtual AttackResult capsuleAttack (int power_of_capsule, GridCell &cell)=0
 
virtual void defend (int power)=0
 
virtual void move (int steps, Direction way)=0
 
virtual void pick_up_capsule (GridCell &adjacent_cell)=0
 
virtual void drop_capsule (GridCell &adjacent_cell, int power_of_capsule)=0
 
virtual BuildStatus getBuildStatus ()=0
 
virtual GridCellgetBuildTarget ()=0
 
virtual int getInvestedBuildPower ()=0
 
virtual void setBuildTarget (BuildStatus status, GridCell *location)=0
 
virtual void setBuildTarget (BuildStatus status, GridCell *location, vector< uint8_t > message)=0
 
virtual void build (int power)=0
 
virtual void repair (int power)=0
 
virtual void charge (int power, GridCell &ally)=0
 
virtual void sendMessage (vector< uint8_t > message, int power)=0
 
virtual vector< vector< GridCell > > getVisibleNeighborhood ()=0
 
virtual vector< vector< GridCell > > getWorld (int power)=0
 
virtual void scanEnemy (Robot_Specs &enemySpecs, Robot_Status &enemyStatus, GridCell toScan)=0
 

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 12 of file WorldAPI.hpp.

Member Function Documentation

virtual void WorldAPI::build ( int  power)
pure virtual
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.

virtual AttackResult WorldAPI::capsuleAttack ( int  power_of_capsule,
GridCell cell 
)
pure virtual

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.

virtual void WorldAPI::charge ( int  power,
GridCell ally 
)
pure virtual

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.

virtual void WorldAPI::defend ( int  power)
pure virtual

Defend: increase defense

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

Implemented in RoboSim::RoboAPIImplementor.

Referenced by DefenderBot::act().

Here is the caller graph for this function:

virtual void WorldAPI::drop_capsule ( GridCell adjacent_cell,
int  power_of_capsule 
)
pure virtual

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.

virtual BuildStatus WorldAPI::getBuildStatus ( )
pure virtual

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.

virtual GridCell* WorldAPI::getBuildTarget ( )
pure virtual
Returns
GridCell indicating the target of our building efforts. Is null if we're not building anything.

Implemented in RoboSim::RoboAPIImplementor.

virtual int WorldAPI::getInvestedBuildPower ( )
pure virtual
Returns
how much we've invested in our current build target.

Implemented in RoboSim::RoboAPIImplementor.

virtual vector<vector<GridCell> > WorldAPI::getVisibleNeighborhood ( )
pure virtual

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 DemoBot::act().

Here is the caller graph for this function:

virtual vector<vector<GridCell> > WorldAPI::getWorld ( int  power)
pure virtual

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.

Referenced by DemoBot::act().

Here is the caller graph for this function:

virtual AttackResult WorldAPI::meleeAttack ( int  power,
GridCell adjacent_cell 
)
pure virtual

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 DemoBot::searchAndDestroy().

Here is the caller graph for this function:

virtual void WorldAPI::move ( int  steps,
Direction  way 
)
pure virtual

move: move robot

Parameters
stepshow far to move
waywhich way to move

Implemented in RoboSim::RoboAPIImplementor.

Referenced by DemoBot::searchAndDestroy().

Here is the caller graph for this function:

virtual void WorldAPI::pick_up_capsule ( GridCell adjacent_cell)
pure virtual

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.

virtual AttackResult WorldAPI::rangedAttack ( int  power,
GridCell nonadjacent_cell 
)
pure virtual

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.

virtual void WorldAPI::repair ( int  power)
pure virtual

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.

Referenced by DefenderBot::act().

Here is the caller graph for this function:

virtual void WorldAPI::scanEnemy ( Robot_Specs enemySpecs,
Robot_Status enemyStatus,
GridCell  toScan 
)
pure virtual

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.

virtual void WorldAPI::sendMessage ( vector< uint8_t >  message,
int  power 
)
pure virtual

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.

virtual void WorldAPI::setBuildTarget ( BuildStatus  status,
GridCell location 
)
pure virtual

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.

virtual void WorldAPI::setBuildTarget ( BuildStatus  status,
GridCell location,
vector< uint8_t >  message 
)
pure virtual

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 class was generated from the following file: