robocraft.player
Class Robot

java.lang.Object
  extended byrobocraft.player.GameObject
      extended byrobocraft.player.Robot

public class Robot
extends GameObject

reference to Robot GameObject. Typically, this will be a reference to another Robot in the world that you encounter in your travels, but you also, as you implement AbstractRobotPlayer, will have a reference to self, which be be the Robot that your RobotPlayer is controlling. All of the accessor methods should succeed when called on self.


Method Summary
 boolean canAttackSquare(MapLocation loc)
          Return whether a given location is within this robot's ATTACK range, given its current position and direction.
 boolean canMove(Direction dir)
          Returns whether this robot can move in the the specified direction, IF it were facing in that direction.
 boolean canSenseObject(GameObject obj)
          Return whether a given GameObject is within this robot's SENSOR range, given its current position and direction.
 boolean canSenseSquare(MapLocation loc)
          Return whether a given location is within this robot's SENSOR range, given its current position and direction.
 ActionType getCurrentAction()
          Returns current action this robot is engaged in, or ActionType.IDLE if robot is not active.
 Direction getDirection()
          Returns current direction this robot is facing.
 double getEnergonLevel()
          Returns current energon level of this robot.
 int getRoundsUntilIdle()
          Returns the number of rounds until isActive() will return false.
 RobotType getRType()
          Returns the type of robot this is.
 boolean isActive()
          Returns whether this robot is active or not.
 
Methods inherited from class robocraft.player.GameObject
equals, getID, getLocation, getTeam, getType, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getRType

public RobotType getRType()
Returns the type of robot this is. Always succeeds.


getEnergonLevel

public double getEnergonLevel()
                       throws GameActionException
Returns current energon level of this robot.

Throws:
GameActionException - if this robot doesn't exist anymore or is out of sensor range.

isActive

public boolean isActive()
                 throws GameActionException
Returns whether this robot is active or not.

Throws:
GameActionException - if this robot doesn't exist anymore or is out of sensor range.

getCurrentAction

public ActionType getCurrentAction()
                            throws GameActionException
Returns current action this robot is engaged in, or ActionType.IDLE if robot is not active.

Throws:
GameActionException - if this robot doesn't exist anymore or is out of sensor range.

getDirection

public Direction getDirection()
                       throws GameActionException
Returns current direction this robot is facing.

Throws:
GameActionException - if this robot doesn't exist anymore or is out of sensor range.

getRoundsUntilIdle

public int getRoundsUntilIdle()
                       throws GameActionException
Returns the number of rounds until isActive() will return false.

Throws:
GameActionException - if this robot doesn't exist anymore or is out of sensor range.

canMove

public boolean canMove(Direction dir)
                throws GameActionException
Returns whether this robot can move in the the specified direction, IF it were facing in that direction. It does not matter which direction the robot is currently facing. Returns FALSE if you pass in OMNI or NONE.

Parameters:
dir - the hypothetical direction of movement
Throws:
GameActionException - if this robot doesn't exist anymore or is out of sensor range

canSenseSquare

public boolean canSenseSquare(MapLocation loc)
                       throws GameActionException
Return whether a given location is within this robot's SENSOR range, given its current position and direction. i.e., this method returns whether or not an object at loc would appear in the array returned from senseNearbyObjects().

Parameters:
loc - the MapLocation being tested.
Returns:
whether you can SENSE this square or not.
Throws:
GameActionException - if this robot does not exist anymore, or if this robot is out of your sensor range.

canSenseObject

public boolean canSenseObject(GameObject obj)
                       throws GameActionException
Return whether a given GameObject is within this robot's SENSOR range, given its current position and direction. i.e., this method returns whether or not the object would appear in the array returned from senseNearbyObjects().

Parameters:
obj - the GameObject to test
Returns:
whether you can SENSE this object or not; false if obj does not exist or is out of your sensor range
Throws:
GameActionException - if this robot does not exist anymore, or is out of your sensor range.

canAttackSquare

public boolean canAttackSquare(MapLocation loc)
                        throws GameActionException
Return whether a given location is within this robot's ATTACK range, given its current position and direction. i.e., this method returns whether a call ot attack(loc) would fail or not.

Parameters:
loc - the MapLocation being tested.
Returns:
whether you can ATTACK this square or not.
Throws:
GameActionException - if this robot does not exist anymore, or if this robot is out of your sensor range.