Class Bot
-
Field Summary
Fields inherited from interface dev.robocode.tankroyale.botapi.IBaseBot
MAX_NUMBER_OF_TEAM_MESSAGES_PER_TURN, TEAM_MESSAGE_MAX_SIZE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
back
(double distance) Moves the bot backward until it has traveled a specific distance from its current position, or it is moving into an obstacle.final void
fire
(double firepower) Fire the gun in the direction as the gun is pointing.final void
forward
(double distance) Moves the bot forward until it has traveled a specific distance from its current position, or it is moving into an obstacle.final double
Returns the distance remaining till the bot has finished moving after having calledIBot.setForward(double)
,IBot.setBack(double)
,IBot.forward(double)
, orIBot.back(double)
.final double
Returns the remaining turn in degrees till the gun has finished turning after having calledIBot.setTurnGunLeft(double)
,IBot.setTurnGunRight(double)
,IBot.turnGunLeft(double)
, orIBot.turnGunRight(double)
.final double
Returns the remaining turn in degrees till the radar has finished turning after having calledIBot.setTurnRadarLeft(double)
,IBot.setTurnRadarRight(double)
,IBot.turnRadarLeft(double)
, orIBot.turnRadarRight(double)
.final double
Returns the remaining turn in degrees till the bot has finished turning after having calledIBot.setTurnLeft(double)
,IBot.setTurnRight(double)
,IBot.turnLeft(double)
, orIBot.turnRight(double)
.final boolean
Checks if this bot is running.final void
rescan()
Scan (again) with the radar.final void
resume()
Resume the movement prior to calling theIBaseBot.setStop()
orIBot.stop()
method.final void
setBack
(double distance) Set the bot to move backward until it has traveled a specific distance from its current position, or it is moving into an obstacle.final void
setForward
(double distance) Set the bot to move forward until it has traveled a specific distance from its current position, or it is moving into an obstacle.final void
setGunTurnRate
(double turnRate) Sets the turn rate of the gun, which can be positive and negative.final void
setRadarTurnRate
(double turnRate) Sets the turn rate of the radar, which can be positive and negative.final void
setTargetSpeed
(double targetSpeed) Sets the new target speed for the bot in units per turn.final void
setTurnGunLeft
(double degrees) Set the gun to turn to the left (following the increasing degrees of the unit circle) until it turned the specified amount of degrees.final void
setTurnGunRight
(double degrees) Set the gun to turn to the right (following the decreasing degrees of the unit circle) until it turned the specified amount of degrees.final void
setTurnLeft
(double degrees) Set the bot to turn to the left (following the increasing degrees of the unit circle) until it turned the specified amount of degrees.final void
setTurnRadarLeft
(double degrees) Set the radar to turn to the left (following the increasing degrees of the unit circle) until it turned the specified amount of degrees.final void
setTurnRadarRight
(double degrees) Set the radar to turn to the right (following the decreasing degrees of the unit circle) until it turned the specified amount of degrees.final void
setTurnRate
(double turnRate) Sets the turn rate of the bot, which can be positive and negative.final void
setTurnRight
(double degrees) Set the bot to turn to the right (following the decreasing degrees of the unit circle) until it turned the specified amount of degrees.final void
stop()
Stop all movement including turning the gun and radar.final void
stop
(boolean overwrite) Stop all movement including turning the gun and radar.final void
turnGunLeft
(double degrees) Turn the gun to the left (following the increasing degrees of the unit circle) until it turned the specified amount of degrees.final void
turnGunRight
(double degrees) Turn the gun to the right (following the decreasing degrees of the unit circle) until it turned the specified amount of degrees.final void
turnLeft
(double degrees) Turn the bot to the left (following the increasing degrees of the unit circle) until it turned the specified amount of degrees.final void
turnRadarLeft
(double degrees) Turn the radar to the left (following the increasing degrees of the unit circle) until it turned the specified amount of degrees.final void
turnRadarRight
(double degrees) Turn the radar to the right (following the increasing degrees of the unit circle) until it turned the specified amount of degrees.final void
turnRight
(double degrees) Turn the bot to the right (following the increasing degrees of the unit circle) until it turned the specified amount of degrees.final void
Blocks until a condition is met, i.e.Methods inherited from class dev.robocode.tankroyale.botapi.BaseBot
addCustomEvent, broadcastTeamMessage, calcBulletSpeed, calcGunHeat, calcMaxTurnRate, clearEvents, getArenaHeight, getArenaWidth, getBodyColor, getBulletColor, getBulletStates, getDirection, getEnemyCount, getEnergy, getEventPriority, getEvents, getFirepower, getGameType, getGunColor, getGunCoolingRate, getGunDirection, getGunHeat, getGunTurnRate, getMaxGunTurnRate, getMaxInactivityTurns, getMaxRadarTurnRate, getMaxSpeed, getMaxTurnRate, getMyId, getNumberOfRounds, getRadarColor, getRadarDirection, getRadarTurnRate, getRoundNumber, getScanColor, getSpeed, getTargetSpeed, getTeammateIds, getTimeLeft, getTracksColor, getTurnNumber, getTurnRate, getTurnTimeout, getTurretColor, getVariant, getVersion, getX, getY, go, isAdjustGunForBodyTurn, isAdjustRadarForBodyTurn, isAdjustRadarForGunTurn, isDisabled, isStopped, isTeammate, removeCustomEvent, sendTeamMessage, setAdjustGunForBodyTurn, setAdjustRadarForBodyTurn, setAdjustRadarForGunTurn, setBodyColor, setBulletColor, setEventPriority, setFire, setFireAssist, setGunColor, setInterruptible, setMaxGunTurnRate, setMaxRadarTurnRate, setMaxSpeed, setMaxTurnRate, setRadarColor, setRescan, setResume, setScanColor, setStop, setStop, setTracksColor, setTurretColor, start
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.robocode.tankroyale.botapi.IBaseBot
addCustomEvent, bearingTo, broadcastTeamMessage, calcBearing, calcBulletSpeed, calcDeltaAngle, calcGunBearing, calcGunHeat, calcMaxTurnRate, calcRadarBearing, clearEvents, directionTo, distanceTo, getArenaHeight, getArenaWidth, getBodyColor, getBulletColor, getBulletStates, getDirection, getEnemyCount, getEnergy, getEventPriority, getEvents, getFirepower, getGameType, getGunColor, getGunCoolingRate, getGunDirection, getGunHeat, getGunTurnRate, getMaxGunTurnRate, getMaxInactivityTurns, getMaxRadarTurnRate, getMaxSpeed, getMaxTurnRate, getMyId, getNumberOfRounds, getRadarColor, getRadarDirection, getRadarTurnRate, getRoundNumber, getScanColor, getSpeed, getTargetSpeed, getTeammateIds, getTimeLeft, getTracksColor, getTurnNumber, getTurnRate, getTurnTimeout, getTurretColor, getVariant, getVersion, getX, getY, go, gunBearingTo, isAdjustGunForBodyTurn, isAdjustRadarForBodyTurn, isAdjustRadarForGunTurn, isDisabled, isStopped, isTeammate, normalizeAbsoluteAngle, normalizeRelativeAngle, onBotDeath, onBulletFired, onBulletHit, onBulletHitBullet, onBulletHitWall, onConnected, onConnectionError, onCustomEvent, onDeath, onDisconnected, onGameEnded, onGameStarted, onHitBot, onHitByBullet, onHitWall, onRoundEnded, onRoundStarted, onScannedBot, onSkippedTurn, onTeamMessage, onTick, onWonRound, radarBearingTo, removeCustomEvent, sendTeamMessage, setAdjustGunForBodyTurn, setAdjustRadarForBodyTurn, setAdjustRadarForGunTurn, setBodyColor, setBulletColor, setEventPriority, setFire, setFireAssist, setGunColor, setInterruptible, setMaxGunTurnRate, setMaxRadarTurnRate, setMaxSpeed, setMaxTurnRate, setRadarColor, setRescan, setResume, setScanColor, setStop, setStop, setTracksColor, setTurretColor, start
-
Constructor Details
-
Bot
protected Bot()- See Also:
-
Bot
- See Also:
-
Bot
-
Bot
-
-
Method Details
-
setTurnRate
public final void setTurnRate(double turnRate) Sets the turn rate of the bot, which can be positive and negative. The turn rate is measured in degrees per turn. The turn rate is added to the current direction of the bot. But it is also added to the current direction of the gun and radar. This is because the gun is mounted on the body, and hence turns with the body. The radar is mounted on the gun and hence moves with the gun. You can compensate for the turn rate of the bot by subtracting the turn rate of the bot from the turn rate of the gun and radar. But be aware that the turn limits defined for the gun and radar cannot be exceeded.The turn rate is truncated to
Constants.MAX_TURN_RATE
if the turn rate exceeds this value.If this property is set multiple times, the last value set before
IBaseBot.go()
counts.- Specified by:
setTurnRate
in interfaceIBaseBot
- Overrides:
setTurnRate
in classBaseBot
- Parameters:
turnRate
- is the new turn rate of the bot in degrees per turn.
-
setGunTurnRate
public final void setGunTurnRate(double turnRate) Sets the turn rate of the gun, which can be positive and negative. The gun turn rate is measured in degrees per turn. The turn rate is added to the current turn direction of the gun. But it is also added to the current direction of the radar. This is because the radar is mounted on the gun, and hence moves with the gun. You can compensate for the turn rate of the gun by subtracting the turn rate of the gun from the turn rate of the radar. But be aware that the turn limits defined for the radar cannot be exceeded.The gun turn rate is truncated to
Constants.MAX_GUN_TURN_RATE
if the gun turn rate exceeds this value.If this property is set multiple times, the last value set before
IBaseBot.go()
counts.- Specified by:
setGunTurnRate
in interfaceIBaseBot
- Overrides:
setGunTurnRate
in classBaseBot
- Parameters:
turnRate
- is the new turn rate of the gun in degrees per turn.
-
setRadarTurnRate
public final void setRadarTurnRate(double turnRate) Sets the turn rate of the radar, which can be positive and negative. The radar turn rate is measured in degrees per turn. The turn rate is added to the current direction of the radar. Note that besides the turn rate of the radar, the turn rates of the bot and gun are also added to the radar direction, as the radar moves with the gun, which is mounted on the gun that moves with the body. You can compensate for the turn rate of the gun by subtracting the turn rate of the bot and gun from the turn rate of the radar. But be aware that the turn limits defined for the radar cannot be exceeded.The radar turn rate is truncated to
Constants.MAX_RADAR_TURN_RATE
if the radar turn rate exceeds this value.If this property is set multiple times, the last value set before
IBaseBot.go()
counts.- Specified by:
setRadarTurnRate
in interfaceIBaseBot
- Overrides:
setRadarTurnRate
in classBaseBot
- Parameters:
turnRate
- is the new turn rate of the radar in degrees per turn.
-
isRunning
-
setTargetSpeed
public final void setTargetSpeed(double targetSpeed) Sets the new target speed for the bot in units per turn. The target speed is the speed you want to achieve eventually, which could take one to several turns depending on the current speed. For example, if the bot is moving forward with max speed, and then must change to move backward at full speed, the bot will have to first decelerate/brake its positive speed (moving forward). When passing speed of zero, it will then have to accelerate back to achieve max negative speed.Note that acceleration is 1 unit per turn and deceleration/braking is faster than acceleration as it is -2 unit per turn. Deceleration is negative as it is added to the speed and hence needs to be negative when slowing down.
The target speed is truncated to
Constants.MAX_SPEED
if the target speed exceeds this value.If this property is set multiple times, the last value set before
IBaseBot.go()
counts.- Specified by:
setTargetSpeed
in interfaceIBaseBot
- Overrides:
setTargetSpeed
in classBaseBot
- Parameters:
targetSpeed
- is the new target speed in units per turn.
-
setForward
public final void setForward(double distance) Set the bot to move forward until it has traveled a specific distance from its current position, or it is moving into an obstacle. The speed is limited byIBaseBot.setMaxSpeed(double)
.When the bot is moving forward, the
Constants.ACCELERATION
determines the acceleration of the bot that adds 1 additional unit to the speed per turn while accelerating. However, the bot is faster at braking. TheConstants.DECELERATION
determines the deceleration of the bot that subtracts 2 units from the speed per turn.This method will first be executed when
IBaseBot.go()
is called making it possible to call other set methods before execution. This makes it possible to set the bot to move, turn the body, radar, gun, and also fire the gun in parallel in a single turn when callingIBaseBot.go()
. But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to callingIBaseBot.go()
.If this method is called multiple times, the last call before
IBaseBot.go()
is executed, counts.This method will cancel the effect of prior calls to
IBaseBot.setTargetSpeed(double)
as the setForward andIBot.setBack(double)
methods calls theIBaseBot.setTargetSpeed(double)
for each turn untilIBot.getDistanceRemaining()
reaches 0.- Specified by:
setForward
in interfaceIBot
- Parameters:
distance
- is the distance to move forward. If negative, the bot will move backward. IfDouble.POSITIVE_INFINITY
the bot will move forward infinitely. IfDouble.NEGATIVE_INFINITY
the bot will move backward infinitely.- See Also:
-
forward
public final void forward(double distance) Moves the bot forward until it has traveled a specific distance from its current position, or it is moving into an obstacle. The speed is limited byIBaseBot.setMaxSpeed(double)
.When the bot is moving forward, the
Constants.ACCELERATION
determine the acceleration of the bot that adds 1 additional unit to the speed per turn while accelerating. However, the bot is faster at braking. TheConstants.DECELERATION
determines the deceleration of the bot that subtracts 2 units from the speed per turn.This call is executed immediately by calling
IBaseBot.go()
in the code behind. This method will block until it has been completed, which can take one to several turns. New commands will first take place after this method is completed. If you need to execute multiple commands in parallel, use setter methods instead of this blocking method.This method will cancel the effect of prior calls to
IBaseBot.setTargetSpeed(double)
,IBot.setForward(double)
, andIBot.setBack(double)
methods.- Specified by:
forward
in interfaceIBot
- Parameters:
distance
- is the distance to move forward. If negative, the bot will move backward. IfDouble.POSITIVE_INFINITY
the bot will move forward infinitely. IfDouble.NEGATIVE_INFINITY
the bot will move backward infinitely.- See Also:
-
setBack
public final void setBack(double distance) Set the bot to move backward until it has traveled a specific distance from its current position, or it is moving into an obstacle. The speed is limited byIBaseBot.setMaxSpeed(double)
.When the bot is moving forward, the
Constants.ACCELERATION
determines the acceleration of the bot that adds 1 additional unit to the speed per turn while accelerating. However, the bot is faster at braking. TheConstants.DECELERATION
determines the deceleration of the bot that subtracts 2 units from the speed per turn.This method will first be executed when
IBaseBot.go()
is called making it possible to call other set methods after execution. This makes it possible to set the bot to move, turn the body, radar, gun, and also fire the gun in parallel in a single turn when callingIBaseBot.go()
. But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to callingIBaseBot.go()
.If this method is called multiple times, the last call before
IBaseBot.go()
is executed, counts.This method will cancel the effect of prior calls to
IBaseBot.setTargetSpeed(double)
as theIBot.setForward(double)
and setBack methods calls theIBaseBot.setTargetSpeed(double)
for each turn untilIBot.getDistanceRemaining()
reaches 0.- Specified by:
setBack
in interfaceIBot
- Parameters:
distance
- is the distance to move backward. If negative, the bot will move forward. IfDouble.POSITIVE_INFINITY
the bot will move backward infinitely. IfDouble.NEGATIVE_INFINITY
the bot will move forward infinitely.- See Also:
-
back
public final void back(double distance) Moves the bot backward until it has traveled a specific distance from its current position, or it is moving into an obstacle. The speed is limited byIBaseBot.setMaxSpeed(double)
.When the bot is moving forward, the
Constants.ACCELERATION
determine the acceleration of the bot that adds 1 additional unit to the speed per turn while accelerating. However, the bot is faster at braking. TheConstants.DECELERATION
determine the deceleration of the bot that subtracts 2 units from the speed per turn.This call is executed immediately by calling
IBaseBot.go()
in the code behind. This method will block until it has been completed, which can take one to several turns. New commands will first take place after this method is completed. If you need to execute multiple commands in parallel, use setter methods instead of this blocking method.This method will cancel the effect of prior calls to
IBaseBot.setTargetSpeed(double)
,IBot.setForward(double)
, andIBot.setBack(double)
methods.- Specified by:
back
in interfaceIBot
- Parameters:
distance
- is the distance to move backward. If negative, the bot will move forward. IfDouble.POSITIVE_INFINITY
the bot will move backward infinitely. IfDouble.NEGATIVE_INFINITY
the bot will move forward infinitely.- See Also:
-
getDistanceRemaining
public final double getDistanceRemaining()Returns the distance remaining till the bot has finished moving after having calledIBot.setForward(double)
,IBot.setBack(double)
,IBot.forward(double)
, orIBot.back(double)
. When the distance remaining has reached 0, the bot has finished its current move.When the distance remaining is positive, the bot is moving forward. When the distance remaining is negative, the bot is moving backward.
- Specified by:
getDistanceRemaining
in interfaceIBot
- Returns:
- The remaining distance to move before its current movement is completed.
If
Double.POSITIVE_INFINITY
the bot will move forward infinitely. IfDouble.NEGATIVE_INFINITY
the bot will move backward infinitely. - See Also:
-
setTurnLeft
public final void setTurnLeft(double degrees) Set the bot to turn to the left (following the increasing degrees of the unit circle) until it turned the specified amount of degrees. That is, whenIBot.getTurnRemaining()
is 0. The amount of degrees to turn each turn is limited byIBaseBot.setMaxTurnRate(double)
.This method will first be executed when
IBaseBot.go()
is called making it possible to call other set methods after execution. This makes it possible to set the bot to move, turn the body, radar, gun, and also fire the gun in parallel in a single turn when callingIBaseBot.go()
. But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to callingIBaseBot.go()
.If this method is called multiple times, the last call before
IBaseBot.go()
is executed, counts.This method will cancel the effect of prior calls to
IBot.setTurnRight(double)
.- Specified by:
setTurnLeft
in interfaceIBot
- Parameters:
degrees
- is the amount of degrees to turn left. If negative, the bot will turn right. IfDouble.POSITIVE_INFINITY
the bot will turn left infinitely. IfDouble.NEGATIVE_INFINITY
the bot will turn right infinitely.- See Also:
-
turnLeft
public final void turnLeft(double degrees) Turn the bot to the left (following the increasing degrees of the unit circle) until it turned the specified amount of degrees. That is, whenIBot.getTurnRemaining()
is 0. The amount of degrees to turn each turn is limited byIBaseBot.setMaxTurnRate(double)
.This call is executed immediately by calling
IBaseBot.go()
in the code behind. This method will block until it has been completed, which can take one to several turns. New commands will first take place after this method is completed. If you need to execute multiple commands in parallel, use setter methods instead of this blocking method.This method will cancel the effect of prior calls to
IBot.setTurnLeft(double)
andIBot.setTurnRight(double)
.- Specified by:
turnLeft
in interfaceIBot
- Parameters:
degrees
- is the amount of degrees to turn left. If negative, the bot will turn right. IfDouble.POSITIVE_INFINITY
the bot will turn left infinitely. IfDouble.NEGATIVE_INFINITY
the bot will turn right infinitely.- See Also:
-
setTurnRight
public final void setTurnRight(double degrees) Set the bot to turn to the right (following the decreasing degrees of the unit circle) until it turned the specified amount of degrees. That is, whenIBot.getTurnRemaining()
is 0. The amount of degrees to turn each turn is limited byIBaseBot.setMaxTurnRate(double)
.This method will first be executed when
IBaseBot.go()
is called making it possible to call other set methods after execution. This makes it possible to set the bot to move, turn the body, radar, gun, and also fire the gun in parallel in a single turn when callingIBaseBot.go()
. But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to callingIBaseBot.go()
.If this method is called multiple times, the last call before
IBaseBot.go()
is executed, counts.This method will cancel the effect of prior calls to
IBot.setTurnLeft(double)
.- Specified by:
setTurnRight
in interfaceIBot
- Parameters:
degrees
- is the amount of degrees to turn right. If negative, the bot will turn left. IfDouble.POSITIVE_INFINITY
the bot will turn right infinitely. IfDouble.NEGATIVE_INFINITY
the bot will turn left infinitely.- See Also:
-
turnRight
public final void turnRight(double degrees) Turn the bot to the right (following the increasing degrees of the unit circle) until it turned the specified amount of degrees. That is, whenIBot.getTurnRemaining()
is 0. The amount of degrees to turn each turn is limited byIBaseBot.setMaxTurnRate(double)
.This call is executed immediately by calling
IBaseBot.go()
in the code behind. This method will block until it has been completed, which can take one to several turns. New commands will first take place after this method is completed. If you need to execute multiple commands in parallel, use setter methods instead of this blocking method.This method will cancel the effect of prior calls to
IBot.setTurnLeft(double)
andIBot.setTurnRight(double)
.- Specified by:
turnRight
in interfaceIBot
- Parameters:
degrees
- is the amount of degrees to turn right. If negative, the bot will turn left. IfDouble.POSITIVE_INFINITY
the bot will turn right infinitely. IfDouble.NEGATIVE_INFINITY
the bot will turn left infinitely.- See Also:
-
getTurnRemaining
public final double getTurnRemaining()Returns the remaining turn in degrees till the bot has finished turning after having calledIBot.setTurnLeft(double)
,IBot.setTurnRight(double)
,IBot.turnLeft(double)
, orIBot.turnRight(double)
. When the turn remaining has reached 0, the bot has finished turning.When the turn remaining is positive, the bot is turning to the left (along the unit circle). When the turn remaining is negative, the bot is turning to the right.
- Specified by:
getTurnRemaining
in interfaceIBot
- Returns:
- The remaining degrees to turn before its current turning is completed.
If
Double.POSITIVE_INFINITY
the bot will turn left infinitely. IfDouble.NEGATIVE_INFINITY
the bot will turn right infinitely. - See Also:
-
setTurnGunLeft
public final void setTurnGunLeft(double degrees) Set the gun to turn to the left (following the increasing degrees of the unit circle) until it turned the specified amount of degrees. That is, whenIBot.getGunTurnRemaining()
is 0. The amount of degrees to turn each turn is limited byIBaseBot.setMaxGunTurnRate(double)
.This method will first be executed when
IBaseBot.go()
is called making it possible to call other set methods after execution. This makes it possible to set the bot to move, turn the body, radar, gun, and also fire the gun in parallel in a single turn when callingIBaseBot.go()
. But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to callingIBaseBot.go()
.If this method is called multiple times, the last call before
IBaseBot.go()
is executed, counts.This method will cancel the effect of prior calls to
IBot.setTurnGunRight(double)
.- Specified by:
setTurnGunLeft
in interfaceIBot
- Parameters:
degrees
- is the amount of degrees to turn left. If negative, the gun will turn right. IfDouble.POSITIVE_INFINITY
the gun will turn left infinitely. IfDouble.NEGATIVE_INFINITY
the gun will turn right infinitely.- See Also:
-
turnGunLeft
public final void turnGunLeft(double degrees) Turn the gun to the left (following the increasing degrees of the unit circle) until it turned the specified amount of degrees. That is, whenIBot.getGunTurnRemaining()
is 0. The amount of degrees to turn each turn is limited byIBaseBot.setMaxGunTurnRate(double)
.This call is executed immediately by calling
IBaseBot.go()
in the code behind. This method will block until it has been completed, which can take one to several turns. New commands will first take place after this method is completed. If you need to execute multiple commands in parallel, use setter methods instead of this blocking method.This method will cancel the effect of prior calls to
IBot.setTurnGunLeft(double)
andIBot.setTurnGunRight(double)
.- Specified by:
turnGunLeft
in interfaceIBot
- Parameters:
degrees
- is the amount of degrees to turn left. If negative, the gun will turn right. IfDouble.POSITIVE_INFINITY
the gun will turn left infinitely. IfDouble.NEGATIVE_INFINITY
the gun will turn right infinitely.- See Also:
-
setTurnGunRight
public final void setTurnGunRight(double degrees) Set the gun to turn to the right (following the decreasing degrees of the unit circle) until it turned the specified amount of degrees. That is, whenIBot.getGunTurnRemaining()
is 0. The amount of degrees to turn each turn is limited byIBaseBot.setMaxGunTurnRate(double)
.This method will first be executed when
IBaseBot.go()
is called making it possible to call other set methods after execution. This makes it possible to set the bot to move, turn the body, radar, gun, and also fire the gun in parallel in a single turn when callingIBaseBot.go()
. But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to callingIBaseBot.go()
.If this method is called multiple times, the last call before
IBaseBot.go()
is executed, counts.This method will cancel the effect of prior calls to
IBot.setTurnGunLeft(double)
.- Specified by:
setTurnGunRight
in interfaceIBot
- Parameters:
degrees
- is the amount of degrees to turn right. If negative, the gun will turn left. IfDouble.POSITIVE_INFINITY
the gun will turn right infinitely. IfDouble.NEGATIVE_INFINITY
the gun will turn left infinitely.- See Also:
-
turnGunRight
public final void turnGunRight(double degrees) Turn the gun to the right (following the decreasing degrees of the unit circle) until it turned the specified amount of degrees. That is, whenIBot.getGunTurnRemaining()
is 0. The amount of degrees to turn each turn is limited byIBaseBot.setMaxGunTurnRate(double)
.This call is executed immediately by calling
IBaseBot.go()
in the code behind. This method will block until it has been completed, which can take one to several turns. New commands will first take place after this method is completed. If you need to execute multiple commands in parallel, use setter methods instead of this blocking method.This method will cancel the effect of prior calls to
IBot.setTurnGunLeft(double)
andIBot.setTurnGunRight(double)
.- Specified by:
turnGunRight
in interfaceIBot
- Parameters:
degrees
- is the amount of degrees to turn right. If negative, the gun will turn left. IfDouble.POSITIVE_INFINITY
the gun will turn right infinitely. IfDouble.NEGATIVE_INFINITY
the gun will turn left infinitely.- See Also:
-
getGunTurnRemaining
public final double getGunTurnRemaining()Returns the remaining turn in degrees till the gun has finished turning after having calledIBot.setTurnGunLeft(double)
,IBot.setTurnGunRight(double)
,IBot.turnGunLeft(double)
, orIBot.turnGunRight(double)
. When the turn remaining has reached 0, the gun has finished turning.When the turn remaining is positive, the bot is turning to the left (along the unit circle). When the turn remaining is negative, the bot is turning to the right.
- Specified by:
getGunTurnRemaining
in interfaceIBot
- Returns:
- The remaining degrees to turn the gun before its current turning is completed.
If
Double.POSITIVE_INFINITY
the gun will turn left infinitely. IfDouble.NEGATIVE_INFINITY
the gun will turn right infinitely. - See Also:
-
setTurnRadarLeft
public final void setTurnRadarLeft(double degrees) Set the radar to turn to the left (following the increasing degrees of the unit circle) until it turned the specified amount of degrees. That is, whenIBot.getRadarTurnRemaining()
is 0. The amount of degrees to turn each turn is limited byIBaseBot.setMaxRadarTurnRate(double)
.This method will first be executed when
IBaseBot.go()
is called making it possible to call other set methods after execution. This makes it possible to set the bot to move, turn the body, radar, gun, and also fire the gun in parallel in a single turn when callingIBaseBot.go()
. But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to callingIBaseBot.go()
.If this method is called multiple times, the last call before
IBaseBot.go()
is executed, counts.This method will cancel the effect of prior calls to
IBot.setTurnRadarRight(double)
.- Specified by:
setTurnRadarLeft
in interfaceIBot
- Parameters:
degrees
- is the amount of degrees to turn left. If negative, the radar will turn right. IfDouble.POSITIVE_INFINITY
the radar will turn left infinitely. IfDouble.NEGATIVE_INFINITY
the radar will turn right infinitely.- See Also:
-
turnRadarLeft
public final void turnRadarLeft(double degrees) Turn the radar to the left (following the increasing degrees of the unit circle) until it turned the specified amount of degrees. That is, whenIBot.getRadarTurnRemaining()
is 0. The amount of degrees to turn each turn is limited byIBaseBot.setMaxRadarTurnRate(double)
.This call is executed immediately by calling
IBaseBot.go()
in the code behind. This method will block until it has been completed, which can take one to several turns. New commands will first take place after this method is completed. If you need to execute multiple commands in parallel, use setter methods instead of this blocking method.This method will cancel the effect of prior calls to
IBot.setTurnRadarLeft(double)
andIBot.setTurnRadarRight(double)
.- Specified by:
turnRadarLeft
in interfaceIBot
- Parameters:
degrees
- is the amount of degrees to turn left. If negative, the radar will turn right. IfDouble.POSITIVE_INFINITY
the radar will turn left infinitely. IfDouble.NEGATIVE_INFINITY
the radar will turn right infinitely.- See Also:
-
setTurnRadarRight
public final void setTurnRadarRight(double degrees) Set the radar to turn to the right (following the decreasing degrees of the unit circle) until it turned the specified amount of degrees. That is, whenIBot.getRadarTurnRemaining()
is 0. The amount of degrees to turn each turn is limited byIBaseBot.setMaxRadarTurnRate(double)
.This method will first be executed when
IBaseBot.go()
is called making it possible to call other set methods after execution. This makes it possible to set the bot to move, turn the body, radar, gun, and also fire the gun in parallel in a single turn when callingIBaseBot.go()
. But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to callingIBaseBot.go()
.If this method is called multiple times, the last call before
IBaseBot.go()
is executed, counts.This method will cancel the effect of prior calls to
IBot.setTurnRadarLeft(double)
and setTurnRadarRight(double).- Specified by:
setTurnRadarRight
in interfaceIBot
- Parameters:
degrees
- is the amount of degrees to turn right. If negative, the radar will turn left. IfDouble.POSITIVE_INFINITY
the radar will turn right infinitely. IfDouble.NEGATIVE_INFINITY
the radar will turn left infinitely.- See Also:
-
turnRadarRight
public final void turnRadarRight(double degrees) Turn the radar to the right (following the increasing degrees of the unit circle) until it turned the specified amount of degrees. That is, whenIBot.getRadarTurnRemaining()
is 0. The amount of degrees to turn each turn is limited byIBaseBot.setMaxRadarTurnRate(double)
.This call is executed immediately by calling
IBaseBot.go()
in the code behind. This method will block until it has been completed, which can take one to several turns. New commands will first take place after this method is completed. If you need to execute multiple commands in parallel, use setter methods instead of this blocking method.This method will cancel the effect of prior calls to
IBot.setTurnRadarLeft(double)
andIBot.setTurnRadarRight(double)
.- Specified by:
turnRadarRight
in interfaceIBot
- Parameters:
degrees
- is the amount of degrees to turn right. If negative, the radar will turn left. IfDouble.POSITIVE_INFINITY
the radar will turn right infinitely. IfDouble.NEGATIVE_INFINITY
the radar will turn left infinitely.- See Also:
-
getRadarTurnRemaining
public final double getRadarTurnRemaining()Returns the remaining turn in degrees till the radar has finished turning after having calledIBot.setTurnRadarLeft(double)
,IBot.setTurnRadarRight(double)
,IBot.turnRadarLeft(double)
, orIBot.turnRadarRight(double)
. When the turn remaining has reached 0, the radar has finished turning.When the turn remaining is positive, the bot is turning to the left (along the unit circle). When the turn remaining is negative, the bot is turning to the right.
- Specified by:
getRadarTurnRemaining
in interfaceIBot
- Returns:
- The remaining degrees to turn the radar before its current turning is completed.
If
Double.POSITIVE_INFINITY
the radar will turn left infinitely. IfDouble.NEGATIVE_INFINITY
the radar will turn right infinitely. - See Also:
-
fire
public final void fire(double firepower) Fire the gun in the direction as the gun is pointing.Note that your bot is spending energy when firing a bullet, the amount of energy used for firing the bullet is taken from the bot. The amount of energy loss is equal to firepower.
If the bullet hits an opponent bot, you will gain energy from the bullet hit. When hitting another bot, your bot will be rewarded and retrieve an energy boost of 3x firepower.
The gun will only fire when the firepower is at
Constants.MIN_FIREPOWER
or higher. If the firepower is more thanConstants.MAX_FIREPOWER
, the power will be truncated to the max firepower.Whenever the gun is fired, the gun is heated and needs to cool down before it can fire again. The gun heat must be zero before the gun can fire (see
IBaseBot.getGunHeat()
. The gun heat generated by firing the gun is 1 + (firepower / 5). Hence, the more firepower used the longer it takes to cool down the gun. The gun cooling rate can be read by callingIBaseBot.getGunCoolingRate()
.The amount of energy used for firing the gun is subtracted from the bots total energy. The amount of damage dealt by a bullet hitting another bot is 4x firepower, and if the firepower is greater than 1 it will do an additional 2 x (firepower - 1) damage.
The firepower is truncated to
Constants.MIN_FIREPOWER
andConstants.MAX_FIREPOWER
if the firepower exceeds these values.This call is executed immediately by calling
IBaseBot.go()
in the code behind. This method will block until it has been completed, which can take one to several turns. New commands will first take place after this method is completed. If you need to execute multiple commands in parallel, use setter methods instead of this blocking method.This method will cancel the effect of prior calls to
IBaseBot.setFire(double)
.- Specified by:
fire
in interfaceIBot
- Parameters:
firepower
- is the amount of energy spent on firing the gun. You cannot spend more energy than available from the bot. The bullet power must be greater thanConstants.MIN_FIREPOWER
.- See Also:
-
stop
public final void stop()Stop all movement including turning the gun and radar. The remaining movement is saved for a call toIBaseBot.setResume()
orIBot.resume()
. This method has no effect, if it has already been called.This call is executed immediately by calling
IBaseBot.go()
in the code behind. This method will block until it has been completed, which can take one to several turns. New commands will first take place after this method is completed. If you need to execute multiple commands in parallel, use setter methods instead of this blocking method. -
stop
public final void stop(boolean overwrite) Stop all movement including turning the gun and radar. The remaining movement is saved for a call toIBaseBot.setResume()
orIBot.resume()
.This call is executed immediately by calling
IBaseBot.go()
in the code behind. This method will block until it has been completed, which can take one to several turns. New commands will first take place after this method is completed. If you need to execute multiple commands in parallel, use setter methods instead of this blocking method.- Specified by:
stop
in interfaceIBot
- Parameters:
overwrite
- is set totrue
if the movement saved by a previous call to this method orIBaseBot.setStop()
must be overridden with the current movement. When set tofalse
this method is identical toIBaseBot.setStop()
.- See Also:
-
resume
public final void resume()Resume the movement prior to calling theIBaseBot.setStop()
orIBot.stop()
method. This method has no effect, if it has already been called.This call is executed immediately by calling
IBaseBot.go()
in the code behind. This method will block until it has been completed, which can take one to several turns. New commands will first take place after this method is completed. If you need to execute multiple commands in parallel, use setter methods instead of this blocking method. -
rescan
public final void rescan()Scan (again) with the radar. This method is useful if the radar has not been turning and thereby will not be able to automatically scan bots. This method is useful when the bot movement has stopped, e.g. whenIBot.stop()
has been called. The last radar direction and sweep angle will be used for rescanning for bots. -
waitFor
Blocks until a condition is met, i.e. when aCondition.test()
returns true.
-