Interface IBot
-
Field Summary
Fields inherited from interface dev.robocode.tankroyale.botapi.IBaseBot
MAX_NUMBER_OF_TEAM_MESSAGES_PER_TURN, TEAM_MESSAGE_MAX_SIZE
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.void
fire
(double firepower) Fire the gun in the direction as the gun is pointing.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.double
Returns the distance remaining till the bot has finished moving after having calledsetForward(double)
,setBack(double)
,forward(double)
, orback(double)
.double
Returns the remaining turn in degrees till the gun has finished turning after having calledsetTurnGunLeft(double)
,setTurnGunRight(double)
,turnGunLeft(double)
, orturnGunRight(double)
.double
Returns the remaining turn in degrees till the radar has finished turning after having calledsetTurnRadarLeft(double)
,setTurnRadarRight(double)
,turnRadarLeft(double)
, orturnRadarRight(double)
.double
Returns the remaining turn in degrees till the bot has finished turning after having calledsetTurnLeft(double)
,setTurnRight(double)
,turnLeft(double)
, orturnRight(double)
.boolean
Checks if this bot is running.void
rescan()
Scan (again) with the radar.void
resume()
Resume the movement prior to calling theIBaseBot.setStop()
orstop()
method.default void
run()
The run() method is used for running a program for the bot like: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.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.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.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.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.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.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.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.void
stop()
Stop all movement including turning the gun and radar.void
stop
(boolean overwrite) Stop all movement including turning the gun and radar.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.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.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.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.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.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.void
Blocks until a condition is met, i.e.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, setGunTurnRate, setInterruptible, setMaxGunTurnRate, setMaxRadarTurnRate, setMaxSpeed, setMaxTurnRate, setRadarColor, setRadarTurnRate, setRescan, setResume, setScanColor, setStop, setStop, setTargetSpeed, setTracksColor, setTurnRate, setTurretColor, start
-
Method Details
-
run
default void run()The run() method is used for running a program for the bot like:public void run() { while (isRunning()) { forward(100); turnGunLeft(360); back(100); turnGunRight(360); } }
Note that the program runs in a loop in this example (as long as the bot is running), meaning that it will start moving forward as soon as
turnGunRight(double)
has executed.When running a loop that could potentially run forever. The best practice is to check if the bot is still running to stop and exit the loop. This gives the game a chance of stopping the thread running the loop in the code behind. If the thread is not stopped correctly, the bot may behave strangely in new rounds.
- See Also:
-
isRunning
boolean isRunning()Checks if this bot is running.- Returns:
true
when the bot is running,false
otherwise.
-
setForward
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 andsetBack(double)
methods calls theIBaseBot.setTargetSpeed(double)
for each turn untilgetDistanceRemaining()
reaches 0.- 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
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)
,setForward(double)
, andsetBack(double)
methods.- 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
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 thesetForward(double)
and setBack methods calls theIBaseBot.setTargetSpeed(double)
for each turn untilgetDistanceRemaining()
reaches 0.- 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
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)
,setForward(double)
, andsetBack(double)
methods.- 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
double getDistanceRemaining()Returns the distance remaining till the bot has finished moving after having calledsetForward(double)
,setBack(double)
,forward(double)
, orback(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.
- 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
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, whengetTurnRemaining()
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
setTurnRight(double)
.- 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
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, whengetTurnRemaining()
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
setTurnLeft(double)
andsetTurnRight(double)
.- 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
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, whengetTurnRemaining()
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
setTurnLeft(double)
.- 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
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, whengetTurnRemaining()
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
setTurnLeft(double)
andsetTurnRight(double)
.- 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
double getTurnRemaining()Returns the remaining turn in degrees till the bot has finished turning after having calledsetTurnLeft(double)
,setTurnRight(double)
,turnLeft(double)
, orturnRight(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.
- 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
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, whengetGunTurnRemaining()
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
setTurnGunRight(double)
.- 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
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, whengetGunTurnRemaining()
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
setTurnGunLeft(double)
andsetTurnGunRight(double)
.- 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
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, whengetGunTurnRemaining()
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
setTurnGunLeft(double)
.- 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
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, whengetGunTurnRemaining()
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
setTurnGunLeft(double)
andsetTurnGunRight(double)
.- 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
double getGunTurnRemaining()Returns the remaining turn in degrees till the gun has finished turning after having calledsetTurnGunLeft(double)
,setTurnGunRight(double)
,turnGunLeft(double)
, orturnGunRight(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.
- 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
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, whengetRadarTurnRemaining()
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
setTurnRadarRight(double)
.- 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
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, whengetRadarTurnRemaining()
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
setTurnRadarLeft(double)
andsetTurnRadarRight(double)
.- 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
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, whengetRadarTurnRemaining()
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
setTurnRadarLeft(double)
and setTurnRadarRight(double).- 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
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, whengetRadarTurnRemaining()
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
setTurnRadarLeft(double)
andsetTurnRadarRight(double)
.- 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
double getRadarTurnRemaining()Returns the remaining turn in degrees till the radar has finished turning after having calledsetTurnRadarLeft(double)
,setTurnRadarRight(double)
,turnRadarLeft(double)
, orturnRadarRight(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.
- 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
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)
.- 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
void stop()Stop all movement including turning the gun and radar. The remaining movement is saved for a call toIBaseBot.setResume()
orresume()
. 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.- See Also:
-
stop
void stop(boolean overwrite) Stop all movement including turning the gun and radar. The remaining movement is saved for a call toIBaseBot.setResume()
orresume()
.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.- 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
void resume()Resume the movement prior to calling theIBaseBot.setStop()
orstop()
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.- See Also:
-
rescan
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. whenstop()
has been called. The last radar direction and sweep angle will be used for rescanning for bots.- See Also:
-
waitFor
Blocks until a condition is met, i.e. when aCondition.test()
returns true.- Parameters:
condition
- is the condition that must be met before this method will stop waiting.- See Also:
-