robocode

Class _AdvancedRadiansRobot

Implemented Interfaces:
IBasicEvents, IBasicEvents2, IBasicRobot, IInteractiveEvents, IInteractiveRobot, IPaintEvents, IPaintRobot, Runnable
Known Direct Subclasses:
AdvancedRobot

public class _AdvancedRadiansRobot
extends _AdvancedRobot

This class is used by the system as a placeholder for all *Radians calls in AdvancedRobot. You may refer to this class for documentation only.

You should create a AdvancedRobot instead.

There is no guarantee that this class will exist in future versions of Robocode.

(The Radians methods themselves will continue work, however).

Authors:
Mathew A. Nelson (original)
Flemming N. Larsen (contributor)
Pavel Savara (contributor)
See Also:
AdvancedRobot

Field Summary

Fields inherited from class robocode._RobotBase

out

Constructor Summary

_AdvancedRadiansRobot()
Constructs a new robot.

Method Summary

double
getGunHeadingRadians()
Returns the direction that the robot's gun is facing, in radians.
double
getGunTurnRemainingRadians()
Returns the angle remaining in the gun's turn, in radians.
double
getHeadingRadians()
Returns the direction that the robot's body is facing, in radians.
double
getRadarHeadingRadians()
Returns the direction that the robot's radar is facing, in radians.
double
getRadarTurnRemainingRadians()
Returns the angle remaining in the radar's turn, in radians.
double
getTurnRemainingRadians()
Returns the angle remaining in the robot's turn, in radians.
void
setTurnGunLeftRadians(double radians)
Sets the robot's gun to turn left by radians when the next execution takes place.
void
setTurnGunRightRadians(double radians)
Sets the robot's gun to turn right by radians when the next execution takes place.
void
setTurnLeftRadians(double radians)
Sets the robot's body to turn left by radians when the next execution takes place.
void
setTurnRadarLeftRadians(double radians)
Sets the robot's radar to turn left by radians when the next execution takes place.
void
setTurnRadarRightRadians(double radians)
Sets the robot's radar to turn right by radians when the next execution takes place.
void
setTurnRightRadians(double radians)
Sets the robot's body to turn right by radians when the next execution takes place.
void
turnGunLeftRadians(double radians)
Immediately turns the robot's gun to the left by radians.
void
turnGunRightRadians(double radians)
Immediately turns the robot's gun to the right by radians.
void
turnLeftRadians(double radians)
Immediately turns the robot's body to the left by radians.
void
turnRadarLeftRadians(double radians)
Immediately turns the robot's radar to the left by radians.
void
turnRadarRightRadians(double radians)
Immediately turns the robot's radar to the right by radians.
void
turnRightRadians(double radians)
Immediately turns the robot's body to the right by radians.

Methods inherited from class robocode._AdvancedRobot

double getGunHeadingDegrees, double getHeadingDegrees, double getRadarHeadingDegrees, int getMaxWaitCount, int getWaitCount, void endTurn, void setTurnGunLeftDegrees, void setTurnGunRightDegrees, void setTurnLeftDegrees, void setTurnRadarLeftDegrees, void setTurnRadarRightDegrees, void setTurnRightDegrees, void turnGunLeftDegrees, void turnGunRightDegrees, void turnLeftDegrees, void turnRadarLeftDegrees, void turnRadarRightDegrees, void turnRightDegrees

Methods inherited from class robocode.Robot

ahead, back, doNothing, fire, fireBullet, getBasicEventListener, getBattleFieldHeight, getBattleFieldWidth, getEnergy, getGraphics, getGunCoolingRate, getGunHeading, getGunHeat, getHeading, getHeight, getInteractiveEventListener, getName, getNumRounds, getOthers, getPaintEventListener, getRadarHeading, getRobotRunnable, getRoundNum, getTime, getVelocity, getWidth, getX, getY, onBattleEnded, onBulletHit, onBulletHitBullet, onBulletMissed, onDeath, onHitByBullet, onHitRobot, onHitWall, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragged, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onMouseWheelMoved, onPaint, onRobotDeath, onScannedRobot, onStatus, onWin, resume, run, scan, setAdjustGunForRobotTurn, setAdjustRadarForGunTurn, setAdjustRadarForRobotTurn, setAllColors, setBodyColor, setBulletColor, setColors, setColors, setGunColor, setRadarColor, setScanColor, stop, stop, turnGunLeft, turnGunRight, turnLeft, turnRadarLeft, turnRadarRight, turnRight, void finalize

Methods inherited from class robocode._Robot

String getGunImageName, String getRadarImageName, String getRobotImageName, double getGunCharge, double getLife, int getBattleNum, int getNumBattles, setInterruptible, void setGunImageName, void setRadarImageName, void setRobotImageName

Methods inherited from class robocode._RobotBase

setOut, setPeer

Constructor Details

_AdvancedRadiansRobot

protected _AdvancedRadiansRobot()
Constructs a new robot.

Method Details

getGunHeadingRadians

public double getGunHeadingRadians()
Returns the direction that the robot's gun is facing, in radians. The value returned will be between 0 and 2 * PI (is excluded).

Note that the heading in Robocode is like a compass, where 0 means North, PI / 2 means East, PI means South, and 3 * PI / 4 means West.

Returns:
the direction that the robot's gun is facing, in radians.

getGunTurnRemainingRadians

public double getGunTurnRemainingRadians()
Returns the angle remaining in the gun's turn, in radians.

This call returns both positive and negative values. Positive values means that the gun is currently turning to the right. Negative values means that the gun is currently turning to the left.

Returns:
the angle remaining in the gun's turn, in radians

getHeadingRadians

public double getHeadingRadians()
Returns the direction that the robot's body is facing, in radians. The value returned will be between 0 and 2 * PI (is excluded).

Note that the heading in Robocode is like a compass, where 0 means North, PI / 2 means East, PI means South, and 3 * PI / 4 means West.

Returns:
the direction that the robot's body is facing, in radians.

getRadarHeadingRadians

public double getRadarHeadingRadians()
Returns the direction that the robot's radar is facing, in radians. The value returned will be between 0 and 2 * PI (is excluded).

Note that the heading in Robocode is like a compass, where 0 means North, PI / 2 means East, PI means South, and 3 * PI / 4 means West.

Returns:
the direction that the robot's radar is facing, in radians.

getRadarTurnRemainingRadians

public double getRadarTurnRemainingRadians()
Returns the angle remaining in the radar's turn, in radians.

This call returns both positive and negative values. Positive values means that the radar is currently turning to the right. Negative values means that the radar is currently turning to the left.

Returns:
the angle remaining in the radar's turn, in radians

getTurnRemainingRadians

public double getTurnRemainingRadians()
Returns the angle remaining in the robot's turn, in radians.

This call returns both positive and negative values. Positive values means that the robot is currently turning to the right. Negative values means that the robot is currently turning to the left.

Returns:
the angle remaining in the robot's turn, in radians

setTurnGunLeftRadians

public void setTurnGunLeftRadians(double radians)
Sets the robot's gun to turn left by radians when the next execution takes place.

This call returns immediately, and will not execute until you call execute() or take an action that executes.

Note that both positive and negative values can be given as input, where negative values means that the robot's gun is set to turn right instead of left.

Example:

   // Set the gun to turn 180 degrees to the left
   setTurnGunLeftRadians(Math.PI);
 

// Set the gun to turn 90 degrees to the right instead of left // (overrides the previous order) setTurnGunLeftRadians(-Math.PI / 2);

... // Executes the last setTurnGunLeftRadians() execute();

Parameters:
radians - the amount of radians to turn the robot's gun to the left. If radians > 0 the robot's gun is set to turn left. If radians <320 the robot's gun is set to turn right. If radians = 0 the robot's gun is set to stop turning.

setTurnGunRightRadians

public void setTurnGunRightRadians(double radians)
Sets the robot's gun to turn right by radians when the next execution takes place.

This call returns immediately, and will not execute until you call execute() or take an action that executes.

Note that both positive and negative values can be given as input, where negative values means that the robot's gun is set to turn left instead of right.

Example:

   // Set the gun to turn 180 degrees to the right
   setTurnGunRightRadians(Math.PI);
 

// Set the gun to turn 90 degrees to the left instead of right // (overrides the previous order) setTurnGunRightRadians(-Math.PI / 2);

... // Executes the last setTurnGunRightRadians() execute();

Parameters:
radians - the amount of radians to turn the robot's gun to the right. If radians > 0 the robot's gun is set to turn left. If radians <320 the robot's gun is set to turn right. If radians = 0 the robot's gun is set to stop turning.

setTurnLeftRadians

public void setTurnLeftRadians(double radians)
Sets the robot's body to turn left by radians when the next execution takes place.

This call returns immediately, and will not execute until you call execute() or take an action that executes.

Note that both positive and negative values can be given as input, where negative values means that the robot's body is set to turn right instead of left.

Example:

   // Set the robot to turn 180 degrees to the left
   setTurnLeftRadians(Math.PI);
 

// Set the robot to turn 90 degrees to the right instead of left // (overrides the previous order) setTurnLeftRadians(-Math.PI / 2);

... // Executes the last setTurnLeftRadians() execute();

Parameters:
radians - the amount of radians to turn the robot's body to the left. If radians > 0 the robot is set to turn left. If radians <320 the robot is set to turn right. If radians = 0 the robot is set to stop turning.

setTurnRadarLeftRadians

public void setTurnRadarLeftRadians(double radians)
Sets the robot's radar to turn left by radians when the next execution takes place.

This call returns immediately, and will not execute until you call execute() or take an action that executes.

Note that both positive and negative values can be given as input, where negative values means that the robot's radar is set to turn right instead of left.

Example:

   // Set the radar to turn 180 degrees to the left
   setTurnRadarLeftRadians(Math.PI);
 

// Set the radar to turn 90 degrees to the right instead of left // (overrides the previous order) setTurnRadarLeftRadians(-Math.PI / 2);

... // Executes the last setTurnRadarLeftRadians() execute();

Parameters:
radians - the amount of radians to turn the robot's radar to the left. If radians > 0 the robot's radar is set to turn left. If radians <320 the robot's radar is set to turn right. If radians = 0 the robot's radar is set to stop turning.

setTurnRadarRightRadians

public void setTurnRadarRightRadians(double radians)
Sets the robot's radar to turn right by radians when the next execution takes place.

This call returns immediately, and will not execute until you call execute() or take an action that executes.

Note that both positive and negative values can be given as input, where negative values means that the robot's radar is set to turn left instead of right.

Example:

   // Set the radar to turn 180 degrees to the right
   setTurnRadarRightRadians(Math.PI);
 

// Set the radar to turn 90 degrees to the right instead of right // (overrides the previous order) setTurnRadarRightRadians(-Math.PI / 2);

... // Executes the last setTurnRadarRightRadians() execute();

Parameters:
radians - the amount of radians to turn the robot's radar to the right. If radians > 0 the robot's radar is set to turn left. If radians <320 the robot's radar is set to turn right. If radians = 0 the robot's radar is set to stop turning.

setTurnRightRadians

public void setTurnRightRadians(double radians)
Sets the robot's body to turn right by radians when the next execution takes place.

This call returns immediately, and will not execute until you call execute() or take an action that executes.

Note that both positive and negative values can be given as input, where negative values means that the robot's body is set to turn left instead of right.

Example:

   // Set the robot to turn 180 degrees to the right
   setTurnRightRadians(Math.PI);
 

// Set the robot to turn 90 degrees to the left instead of right // (overrides the previous order) setTurnRightRadians(-Math.PI / 2);

... // Executes the last setTurnRightRadians() execute();

Parameters:
radians - the amount of radians to turn the robot's body to the right. If radians > 0 the robot is set to turn right. If radians <320 the robot is set to turn left. If radians = 0 the robot is set to stop turning.

turnGunLeftRadians

public void turnGunLeftRadians(double radians)
Immediately turns the robot's gun to the left by radians.

This call executes immediately, and does not return until it is complete, i.e. when the angle remaining in the gun's turn is 0.

Note that both positive and negative values can be given as input, where negative values means that the robot's gun is set to turn right instead of left.

Example:

   // Turn the robot's gun 180 degrees to the left
   turnGunLeftRadians(Math.PI);
 

// Afterwards, turn the robot's gun 90 degrees to the right turnGunLeftRadians(-Math.PI / 2);

Parameters:
radians - the amount of radians to turn the robot's gun to the left. If radians > 0 the robot's gun will turn left. If radians <320 the robot's gun will turn right. If radians = 0 the robot's gun will not turn, but execute.

turnGunRightRadians

public void turnGunRightRadians(double radians)
Immediately turns the robot's gun to the right by radians. This call executes immediately, and does not return until it is complete, i.e. when the angle remaining in the gun's turn is 0.

Note that both positive and negative values can be given as input, where negative values means that the robot's gun is set to turn left instead of right.

Example:

   // Turn the robot's gun 180 degrees to the right
   turnGunRightRadians(Math.PI);
 

// Afterwards, turn the robot's gun 90 degrees to the left turnGunRightRadians(-Math.PI / 2);

Parameters:
radians - the amount of radians to turn the robot's gun to the right. If radians > 0 the robot's gun will turn right. If radians <320 the robot's gun will turn left. If radians = 0 the robot's gun will not turn, but execute.

turnLeftRadians

public void turnLeftRadians(double radians)
Immediately turns the robot's body to the left by radians.

This call executes immediately, and does not return until it is complete, i.e. when the angle remaining in the robot's turn is 0.

Note that both positive and negative values can be given as input, where negative values means that the robot's body is set to turn right instead of left.

Example:

   // Turn the robot 180 degrees to the left
   turnLeftRadians(Math.PI);
 

// Afterwards, turn the robot 90 degrees to the right turnLeftRadians(-Math.PI / 2);

Parameters:
radians - the amount of radians to turn the robot's body to the left. If radians > 0 the robot will turn right. If radians <320 the robot will turn left. If radians = 0 the robot will not turn, but execute.

turnRadarLeftRadians

public void turnRadarLeftRadians(double radians)
Immediately turns the robot's radar to the left by radians.

This call executes immediately, and does not return until it is complete, i.e. when the angle remaining in the radar's turn is 0.

Note that both positive and negative values can be given as input, where negative values means that the robot's radar is set to turn right instead of left.

Example:

   // Turn the robot's radar 180 degrees to the left
   turnRadarLeftRadians(Math.PI);
 

// Afterwards, turn the robot's radar 90 degrees to the right turnRadarLeftRadians(-Math.PI / 2);

Parameters:
radians - the amount of radians to turn the robot's radar to the left. If radians > 0 the robot's radar will turn left. If radians <320 the robot's radar will turn right. If radians = 0 the robot's radar will not turn, but execute.

turnRadarRightRadians

public void turnRadarRightRadians(double radians)
Immediately turns the robot's radar to the right by radians. This call executes immediately, and does not return until it is complete, i.e. when the angle remaining in the radar's turn is 0.

Note that both positive and negative values can be given as input, where negative values means that the robot's radar is set to turn left instead of right.

Example:

   // Turn the robot's radar 180 degrees to the right
   turnRadarRightRadians(Math.PI);
 

// Afterwards, turn the robot's radar 90 degrees to the left turnRadarRightRadians(-Math.PI / 2);

Parameters:
radians - the amount of radians to turn the robot's radar to the right. If radians > 0 the robot's radar will turn right. If radians <320 the robot's radar will turn left. If radians = 0 the robot's radar will not turn, but execute.

turnRightRadians

public void turnRightRadians(double radians)
Immediately turns the robot's body to the right by radians. This call executes immediately, and does not return until it is complete, i.e. when the angle remaining in the robot's turn is 0.

Note that both positive and negative values can be given as input, where negative values means that the robot's body is set to turn left instead of right.

Example:

   // Turn the robot 180 degrees to the right
   turnRightRadians(Math.PI);
 

// Afterwards, turn the robot 90 degrees to the left turnRightRadians(-Math.PI / 2);

Parameters:
radians - the amount of radians to turn the robot's body to the right. If radians > 0 the robot will turn right. If radians <320 the robot will turn left. If radians = 0 the robot will not turn, but execute.