Package robocode
Class Rules
java.lang.Object
robocode.Rules
Constants and methods that defines the rules of Robocode.
Constants are used for rules that will not change.
Methods are provided for rules that can be changed between battles or which depends
on some other factor.
- Since:
- 1.1.4
- Author:
- Luis Crespo (original), Flemming N. Larsen (original)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double
The acceleration of a robot, i.e.static final double
The deceleration of a robot, i.e.static final double
The turning rate of the gun measured in degrees, which is 20 degrees/turn.static final double
The turning rate of the gun measured in radians instead of degrees.static final double
The maximum bullet power, i.e.static final double
The maximum turning rate of the robot, in degrees, which is 10 degress/turn.static final double
The maximum turning rate of the robot measured in radians instead of degrees.static final double
The maximum velocity of a robot, which is 8 pixels/turn.static final double
The minimum bullet power, i.e the amount of energy required for firing a bullet, which is 0.1 energy points.static final double
The radar scan radius, which is 1200 pixels.static final double
The turning rate of the radar measured in degrees, which is 45 degrees/turn.static final double
The turning rate of the radar measured in radians instead of degrees.static final double
The amount of bonus damage dealt by a robot ramming an opponent by moving forward into it, which is 2 xROBOT_HIT_DAMAGE
= 1.2 energy points.static final double
The amount of damage taken when a robot hits or is hit by another robot, which is 0.6 energy points. -
Method Summary
Modifier and TypeMethodDescriptionstatic double
getBulletDamage
(double bulletPower) Returns the amount of damage of a bullet given a specific bullet power.static double
getBulletHitBonus
(double bulletPower) Returns the amount of bonus given when a robot's bullet hits an opponent robot given a specific bullet power.static double
getBulletSpeed
(double bulletPower) Returns the speed of a bullet given a specific bullet power measured in pixels/turn.static double
getGunHeat
(double bulletPower) Returns the heat produced by firing the gun given a specific bullet power.static double
getTurnRate
(double velocity) Returns the turn rate of a robot given a specific velocity measured in degrees/turn.static double
getTurnRateRadians
(double velocity) Returns the turn rate of a robot given a specific velocity measured in radians/turn.static double
getWallHitDamage
(double velocity) Returns the amount of damage taken when robot hits a wall with a specific velocity.
-
Field Details
-
ACCELERATION
public static final double ACCELERATIONThe acceleration of a robot, i.e. the increase of velocity when the robot moves forward, which is 1 pixel/turn.- See Also:
-
DECELERATION
public static final double DECELERATIONThe deceleration of a robot, i.e. the decrease of velocity when the robot moves backwards (or brakes), which is 2 pixels/turn.- See Also:
-
MAX_VELOCITY
public static final double MAX_VELOCITYThe maximum velocity of a robot, which is 8 pixels/turn.- See Also:
-
RADAR_SCAN_RADIUS
public static final double RADAR_SCAN_RADIUSThe radar scan radius, which is 1200 pixels. Robots which is more than 1200 pixels away cannot be seen on the radar.- See Also:
-
MIN_BULLET_POWER
public static final double MIN_BULLET_POWERThe minimum bullet power, i.e the amount of energy required for firing a bullet, which is 0.1 energy points.- See Also:
-
MAX_BULLET_POWER
public static final double MAX_BULLET_POWERThe maximum bullet power, i.e. the maximum amount of energy that can be transferred to a bullet when it is fired, which is 3 energy points.- See Also:
-
MAX_TURN_RATE
public static final double MAX_TURN_RATEThe maximum turning rate of the robot, in degrees, which is 10 degress/turn. Note, that the turn rate of the robot depends on it's velocity.- See Also:
-
MAX_TURN_RATE_RADIANS
public static final double MAX_TURN_RATE_RADIANSThe maximum turning rate of the robot measured in radians instead of degrees.- See Also:
-
GUN_TURN_RATE
public static final double GUN_TURN_RATEThe turning rate of the gun measured in degrees, which is 20 degrees/turn. Note, that if setAdjustGunForRobotTurn(true) has been called, the gun turn is independent of the robot turn. In this case the gun moves relatively to the screen. If setAdjustGunForRobotTurn(false) has been called or setAdjustGunForRobotTurn() has not been called at all (this is the default), then the gun turn is dependent on the robot turn, and in this case the gun moves relatively to the robot body.- See Also:
-
GUN_TURN_RATE_RADIANS
public static final double GUN_TURN_RATE_RADIANSThe turning rate of the gun measured in radians instead of degrees.- See Also:
-
RADAR_TURN_RATE
public static final double RADAR_TURN_RATEThe turning rate of the radar measured in degrees, which is 45 degrees/turn. Note, that if setAdjustRadarForRobotTurn(true) and/or setAdjustRadarForGunTurn(true) has been called, the radar turn is independent of the robot and/or gun turn. If both methods has been set to true, the radar moves relatively to the screen. If setAdjustRadarForRobotTurn(false) and/or setAdjustRadarForGunTurn(false) has been called or not called at all (this is the default), then the radar turn is dependent on the robot and/or gun turn, and in this case the radar moves relatively to the gun and/or robot body.- See Also:
-
RADAR_TURN_RATE_RADIANS
public static final double RADAR_TURN_RATE_RADIANSThe turning rate of the radar measured in radians instead of degrees.- See Also:
-
ROBOT_HIT_DAMAGE
public static final double ROBOT_HIT_DAMAGEThe amount of damage taken when a robot hits or is hit by another robot, which is 0.6 energy points.- See Also:
-
ROBOT_HIT_BONUS
public static final double ROBOT_HIT_BONUSThe amount of bonus damage dealt by a robot ramming an opponent by moving forward into it, which is 2 xROBOT_HIT_DAMAGE
= 1.2 energy points.- See Also:
-
-
Method Details
-
getTurnRate
public static double getTurnRate(double velocity) Returns the turn rate of a robot given a specific velocity measured in degrees/turn.- Parameters:
velocity
- the velocity of the robot.- Returns:
- turn rate in degrees/turn.
- See Also:
-
getTurnRateRadians
public static double getTurnRateRadians(double velocity) Returns the turn rate of a robot given a specific velocity measured in radians/turn.- Parameters:
velocity
- the velocity of the robot.- Returns:
- turn rate in radians/turn.
- See Also:
-
getWallHitDamage
public static double getWallHitDamage(double velocity) Returns the amount of damage taken when robot hits a wall with a specific velocity.- Parameters:
velocity
- the velocity of the robot.- Returns:
- wall hit damage in energy points.
-
getBulletDamage
public static double getBulletDamage(double bulletPower) Returns the amount of damage of a bullet given a specific bullet power.- Parameters:
bulletPower
- the energy power of the bullet.- Returns:
- bullet damage in energy points.
-
getBulletHitBonus
public static double getBulletHitBonus(double bulletPower) Returns the amount of bonus given when a robot's bullet hits an opponent robot given a specific bullet power.- Parameters:
bulletPower
- the energy power of the bullet.- Returns:
- bullet hit bonus in energy points.
-
getBulletSpeed
public static double getBulletSpeed(double bulletPower) Returns the speed of a bullet given a specific bullet power measured in pixels/turn.- Parameters:
bulletPower
- the energy power of the bullet.- Returns:
- bullet speed in pixels/turn
-
getGunHeat
public static double getGunHeat(double bulletPower) Returns the heat produced by firing the gun given a specific bullet power.- Parameters:
bulletPower
- the energy power of the bullet.- Returns:
- gun heat
-