Show / Hide Table of Contents

Class Bot

Abstract bot class provides convenient methods for movement, turning, and firing the gun. Most bots should inherit from this class.

Inheritance
object
BaseBot
Bot
Implements
IBot
IBaseBot
Inherited Members
BaseBot.Start()
BaseBot.Go()
BaseBot.Variant
BaseBot.Version
BaseBot.MyId
BaseBot.GameType
BaseBot.ArenaWidth
BaseBot.ArenaHeight
BaseBot.NumberOfRounds
BaseBot.GunCoolingRate
BaseBot.MaxInactivityTurns
BaseBot.TurnTimeout
BaseBot.TimeLeft
BaseBot.RoundNumber
BaseBot.TurnNumber
BaseBot.EnemyCount
BaseBot.Energy
BaseBot.IsDisabled
BaseBot.X
BaseBot.Y
BaseBot.Direction
BaseBot.GunDirection
BaseBot.RadarDirection
BaseBot.Speed
BaseBot.GunHeat
BaseBot.BulletStates
BaseBot.Events
BaseBot.ClearEvents()
BaseBot.MaxTurnRate
BaseBot.MaxGunTurnRate
BaseBot.MaxRadarTurnRate
BaseBot.MaxSpeed
BaseBot.SetFire(double)
BaseBot.SetRescan()
BaseBot.SetFireAssist(bool)
BaseBot.Interruptible
BaseBot.Firepower
BaseBot.AdjustGunForBodyTurn
BaseBot.AdjustRadarForBodyTurn
BaseBot.AdjustRadarForGunTurn
BaseBot.AddCustomEvent(Condition)
BaseBot.RemoveCustomEvent(Condition)
BaseBot.SetStop()
BaseBot.SetStop(bool)
BaseBot.SetResume()
BaseBot.IsStopped
BaseBot.TeammateIds
BaseBot.IsTeammate(int)
BaseBot.BroadcastTeamMessage(object)
BaseBot.SendTeamMessage(int, object)
BaseBot.BodyColor
BaseBot.TurretColor
BaseBot.RadarColor
BaseBot.BulletColor
BaseBot.ScanColor
BaseBot.TracksColor
BaseBot.GunColor
BaseBot.CalcMaxTurnRate(double)
BaseBot.CalcBulletSpeed(double)
BaseBot.CalcGunHeat(double)
BaseBot.CalcBearing(double)
BaseBot.CalcGunBearing(double)
BaseBot.CalcRadarBearing(double)
BaseBot.DirectionTo(double, double)
BaseBot.BearingTo(double, double)
BaseBot.GunBearingTo(double, double)
BaseBot.RadarBearingTo(double, double)
BaseBot.DistanceTo(double, double)
BaseBot.NormalizeAbsoluteAngle(double)
BaseBot.NormalizeRelativeAngle(double)
BaseBot.CalcDeltaAngle(double, double)
BaseBot.GetEventPriority(Type)
BaseBot.SetEventPriority(Type, int)
BaseBot.IsDebuggingEnabled
BaseBot.Graphics
BaseBot.OnConnected(ConnectedEvent)
BaseBot.OnDisconnected(DisconnectedEvent)
BaseBot.OnConnectionError(ConnectionErrorEvent)
BaseBot.OnGameStarted(GameStartedEvent)
BaseBot.OnGameEnded(GameEndedEvent)
BaseBot.OnRoundStarted(RoundStartedEvent)
BaseBot.OnRoundEnded(RoundEndedEvent)
BaseBot.OnTick(TickEvent)
BaseBot.OnBotDeath(BotDeathEvent)
BaseBot.OnDeath(DeathEvent)
BaseBot.OnHitBot(HitBotEvent)
BaseBot.OnHitWall(HitWallEvent)
BaseBot.OnBulletFired(BulletFiredEvent)
BaseBot.OnHitByBullet(HitByBulletEvent)
BaseBot.OnBulletHit(BulletHitBotEvent)
BaseBot.OnBulletHitBullet(BulletHitBulletEvent)
BaseBot.OnBulletHitWall(BulletHitWallEvent)
BaseBot.OnScannedBot(ScannedBotEvent)
BaseBot.OnSkippedTurn(SkippedTurnEvent)
BaseBot.OnWonRound(WonRoundEvent)
BaseBot.OnCustomEvent(CustomEvent)
BaseBot.OnTeamMessage(TeamMessageEvent)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Robocode.TankRoyale.BotApi
Assembly: api.dll
Syntax
[PublicAPI]
public abstract class Bot : BaseBot, IBot, IBaseBot

Constructors

| Edit this page View Source

Bot()

Declaration
protected Bot()
| Edit this page View Source

Bot(BotInfo)

Declaration
protected Bot(BotInfo botInfo)
Parameters
Type Name Description
BotInfo botInfo
| Edit this page View Source

Bot(BotInfo, Uri)

Declaration
protected Bot(BotInfo botInfo, Uri serverUrl)
Parameters
Type Name Description
BotInfo botInfo
Uri serverUrl
| Edit this page View Source

Bot(BotInfo, Uri, string)

Declaration
protected Bot(BotInfo botInfo, Uri serverUrl, string serverSecret)
Parameters
Type Name Description
BotInfo botInfo
Uri serverUrl
string serverSecret

Properties

| Edit this page View Source

DistanceRemaining

The distance remaining till the bot has finished moving after having called SetForward(double), SetBack(double), Forward(double), or 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.

Declaration
public double DistanceRemaining { get; }
Property Value
Type Description
double

The remaining distance to move before its current movement is completed. If PositiveInfinity the bot will move forward infinitely. If NegativeInfinity the bot will move backward infinitely.

See Also
SetForward(double)
SetBack(double)
Forward(double)
Back(double)
| Edit this page View Source

GunTurnRate

Sets or get 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 MaxGunTurnRate if the gun turn rate exceeds this value.

If this property is set multiple times, the last value set before Go() counts.

Declaration
public override double GunTurnRate { set; }
Property Value
Type Description
double

The turn rate of the gun.

Overrides
BaseBot.GunTurnRate
See Also
MaxGunTurnRate
| Edit this page View Source

GunTurnRemaining

The remaining turn in degrees till the gun has finished turning after having called SetTurnGunLeft(double), SetTurnGunRight(double), TurnGunLeft(double), or 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.

Declaration
public double GunTurnRemaining { get; }
Property Value
Type Description
double

The remaining degrees to turn the gun before its current turning is completed. If PositiveInfinity the gun will turn left infinitely. If NegativeInfinity the gun will turn right infinitely.

See Also
SetTurnGunLeft(double)
SetTurnGunRight(double)
TurnGunLeft(double)
TurnGunRight(double)
| Edit this page View Source

IsRunning

Checks if this bot is running.

Declaration
public bool IsRunning { get; }
Property Value
Type Description
bool

true when the bot is running, false otherwise.

| Edit this page View Source

RadarTurnRate

Sets or get 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 MaxRadarTurnRate if the radar turn rate exceeds this value.

If this property is set multiple times, the last value set before Go() counts.

Declaration
public override double RadarTurnRate { set; }
Property Value
Type Description
double

The turn rate of the radar.

Overrides
BaseBot.RadarTurnRate
See Also
MaxRadarTurnRate
| Edit this page View Source

RadarTurnRemaining

The remaining turn in degrees till the radar has finished turning after having called SetTurnRadarLeft(double), SetTurnRadarRight(double), TurnRadarLeft(double), or 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.

Declaration
public double RadarTurnRemaining { get; }
Property Value
Type Description
double

The remaining degrees to turn the radar before its current turning is completed. If PositiveInfinity the radar will turn left infinitely. If NegativeInfinity the radar will turn right infinitely.

See Also
SetTurnRadarLeft(double)
SetTurnRadarRight(double)
TurnRadarLeft(double)
TurnRadarRight(double)
| Edit this page View Source

TargetSpeed

Sets or get the 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

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.

note

The target speed is truncated to MaxSpeed if the target speed exceeds this value.

If this property is set multiple times, the last value set before Go() counts.

Declaration
public double TargetSpeed { get; set; }
Property Value
Type Description
double

The target speed.

| Edit this page View Source

TurnRate

Sets or get 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 MaxTurnRate if the turn rate exceeds this value.

If this property is set multiple times, the last value set before Go() counts.

Declaration
public override double TurnRate { set; }
Property Value
Type Description
double

The turn rate of the bot

Overrides
BaseBot.TurnRate
See Also
MaxTurnRate
| Edit this page View Source

TurnRemaining

The remaining turn in degrees till the bot has finished turning after having called SetTurnLeft(double), SetTurnRight(double), TurnLeft(double), or 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.

Declaration
public double TurnRemaining { get; }
Property Value
Type Description
double

The remaining degrees to turn before its current turning is completed. If PositiveInfinity the bot will turn left infinitely. If NegativeInfinity the bot will turn right infinitely.

See Also
SetTurnLeft(double)
SetTurnRight(double)
TurnLeft(double)
TurnRight(double)

Methods

| Edit this page View Source

Back(double)

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 by MaxSpeed.

When the bot is moving forward, the 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. The Deceleration determines the deceleration of the bot that subtracts 2 units from the speed per turn.

This call is executed immediately by calling 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 TargetSpeed, SetForward(double), and SetBack(double) methods.

Declaration
public void Back(double distance)
Parameters
Type Name Description
double distance

Is the distance to move backward. If negative, the bot will move forward. If PositiveInfinity the bot will move backward infinitely. If NegativeInfinity the bot will move forward infinitely.

See Also
SetForward(double)
SetBack(double)
Forward(double)
DistanceRemaining
TargetSpeed
| Edit this page View Source

Fire(double)

Fire the gun in the direction as the gun is pointing.

note

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 the 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 MinFirepower or higher. If the firepower is more than MaxFirepower, the power will be truncated to the MaxFirepower.

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 GunHeat. 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 from GunCoolingRate.

The amount of energy used for firing the gun is subtracted from the bot´s 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 MinFirepower and MaxFirepower if the firepower exceeds these values.

This call is executed immediately by calling 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 setting SetFire(double).

Declaration
public void Fire(double firepower)
Parameters
Type Name Description
double 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 > MinFirepower.

See Also
OnBulletFired(BulletFiredEvent)
SetFire(double)
GunHeat
GunCoolingRate
| Edit this page View Source

Forward(double)

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 by MaxSpeed.

When the bot is moving forward, the 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. The Deceleration determines the deceleration of the bot that subtracts 2 units from the speed per turn.

This call is executed immediately by calling 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 TargetSpeed, SetForward(double), and SetBack(double) methods.

Declaration
public void Forward(double distance)
Parameters
Type Name Description
double distance

Is the distance to move forward. If negative, the bot will move backward. If PositiveInfinity the bot will move forward infinitely. If NegativeInfinity the bot will move backward infinitely.

See Also
SetForward(double)
SetBack(double)
Back(double)
DistanceRemaining
TargetSpeed
| Edit this page View Source

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. when Stop() has been called. The last radar direction and sweep angle will be used for rescanning for bots.

Declaration
public void Rescan()
See Also
Stop()
| Edit this page View Source

Resume()

Resume the movement prior to calling the SetStop() or Stop() method. This method has no effect, if it has already been called.

This call is executed immediately by calling 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.

Declaration
public void Resume()
See Also
SetStop()
SetResume()
Stop()
| Edit this page View Source

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

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.

Declaration
public virtual void Run()
See Also
IsRunning
| Edit this page View Source

SetBack(double)

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 by MaxSpeed

When the bot is moving forward, the 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. The Deceleration determines the deceleration of the bot that subtracts 2 units from the speed per turn.

This method will first be executed when 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 calling Go(). But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to calling Go().

If this method is called multiple times, the last call before Go() is executed, counts.

This method will cancel the effect of prior setting TargetSpeed as the SetForward(double) and SetBack(double) methods sets the TargetSpeed for each turn until DistanceRemaining reaches 0.

Declaration
public void SetBack(double distance)
Parameters
Type Name Description
double distance

Is the distance to move backward. If negative, the bot will move forward. If PositiveInfinity the bot will move backward infinitely. If NegativeInfinity the bot will move forward infinitely.

See Also
Back(double)
SetForward(double)
Forward(double)
DistanceRemaining
TargetSpeed
| Edit this page View Source

SetForward(double)

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 by MaxSpeed.

When the bot is moving forward, the 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. The Deceleration determines the deceleration of the bot that subtracts 2 units from the speed per turn.

This method will first be executed when 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 calling Go(). But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to calling Go().

If this method is called multiple times, the last call before Go() is executed, counts.

This method will cancel the effect of prior setting TargetSpeed as the SetForward(double) and SetBack(double) methods sets the TargetSpeed for each turn until DistanceRemaining reaches 0.

Declaration
public void SetForward(double distance)
Parameters
Type Name Description
double distance

Is the distance to move forward. If negative, the bot will move backward. If PositiveInfinity the bot will move forward infinitely. If NegativeInfinity the bot will move backward infinitely.

See Also
Forward(double)
SetBack(double)
Back(double)
DistanceRemaining
TargetSpeed
| Edit this page View Source

SetTurnGunLeft(double)

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, when GunTurnRemaining is 0. The amount of degrees to turn each turn is limited by MaxGunTurnRate.

This method will first be executed when 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 calling Go(). But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to calling Go().

If this method is called multiple times, the last call before Go() is executed, counts.

This method will cancel the effect of prior calls to SetTurnGunRight(double).

Declaration
public void SetTurnGunLeft(double degrees)
Parameters
Type Name Description
double degrees

Is the amount of degrees to turn left. If negative, the gun will turn right. If PositiveInfinity the gun will turn left infinitely. If NegativeInfinity the gun will turn right infinitely.

See Also
SetTurnGunRight(double)
TurnGunRight(double)
SetTurnRight(double)
GunTurnRemaining
GunTurnRate
| Edit this page View Source

SetTurnGunRight(double)

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, when GunTurnRemaining is 0. The amount of degrees to turn each turn is limited by MaxGunTurnRate.

This method will first be executed when 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 calling Go(). But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to calling Go().

If this method is called multiple times, the last call before Go() is executed, counts.

This method will cancel the effect of prior calls to SetTurnGunLeft(double).

Declaration
public void SetTurnGunRight(double degrees)
Parameters
Type Name Description
double degrees

Is the amount of degrees to turn right. If negative, the gun will turn left. If PositiveInfinity the gun will turn right infinitely. If NegativeInfinity the gun will turn left infinitely.

See Also
SetTurnGunLeft(double)
TurnGunRight(double)
TurnGunLeft(double)
GunTurnRemaining
GunTurnRate
| Edit this page View Source

SetTurnLeft(double)

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, when TurnRemaining is 0. The amount of degrees to turn each turn is limited by MaxTurnRate.

This method will first be executed when 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 calling Go(). But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to calling Go().

If this method is called multiple times, the last call before Go() is executed, counts.

This method will cancel the effect of prior calls to SetTurnRight(double).

Declaration
public void SetTurnLeft(double degrees)
Parameters
Type Name Description
double degrees

Is the amount of degrees to turn left. If negative, the bot will turn right. If PositiveInfinity the bot will turn left infinitely. If NegativeInfinity the bot will turn right infinitely.

See Also
SetTurnRight(double)
TurnRight(double)
TurnLeft(double)
TurnRemaining
TurnRate
| Edit this page View Source

SetTurnRadarLeft(double)

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, when RadarTurnRemaining is 0. The amount of degrees to turn each turn is limited by MaxRadarTurnRate.

This method will first be executed when 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 calling Go(). But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to calling Go().

If this method is called multiple times, the last call before Go() is executed, counts.

This method will cancel the effect of prior calls to SetTurnRadarRight(double).

Declaration
public void SetTurnRadarLeft(double degrees)
Parameters
Type Name Description
double degrees

Is the amount of degrees to turn left. If negative, the radar will turn right. If PositiveInfinity the radar will turn left infinitely. If NegativeInfinity the radar will turn right infinitely.

See Also
SetTurnRadarRight(double)
TurnRadarRight(double)
TurnRadarLeft(double)
RadarTurnRemaining
RadarTurnRate
| Edit this page View Source

SetTurnRadarRight(double)

Turn the radar to the right (following the decreasing degrees of the unit circle) until it turned the specified amount of degrees. That is, when RadarTurnRemaining is 0. The amount of degrees to turn each turn is limited by MaxRadarTurnRate.

This method will first be executed when 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 calling Go(). But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to calling Go().

If this method is called multiple times, the last call before Go() is executed, counts.

This method will cancel the effect of prior calls to SetTurnRadarLeft(double) and SetTurnRadarRight(double).

Declaration
public void SetTurnRadarRight(double degrees)
Parameters
Type Name Description
double degrees

Is the amount of degrees to turn right. If negative, the radar will turn left. If PositiveInfinity the radar will turn right infinitely. If NegativeInfinity the radar will turn left infinitely.

See Also
SetTurnRadarLeft(double)
TurnRadarLeft(double)
TurnRadarRight(double)
RadarTurnRemaining
RadarTurnRate
| Edit this page View Source

SetTurnRight(double)

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, when TurnRemaining is 0. The amount of degrees to turn each turn is limited by MaxTurnRate.

This method will first be executed when 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 calling Go(). But notice that this is only possible to execute multiple methods in parallel by using setter methods only prior to calling Go().

If this method is called multiple times, the last call before Go() is executed, counts.

This method will cancel the effect of prior calls to SetTurnLeft(double).

Declaration
public void SetTurnRight(double degrees)
Parameters
Type Name Description
double degrees

Is the amount of degrees to turn right. If negative, the bot will turn left. If PositiveInfinity the bot will turn right infinitely. If NegativeInfinity the bot will turn left infinitely.

See Also
SetTurnLeft(double)
TurnRight(double)
TurnLeft(double)
TurnRemaining
TurnRate
| Edit this page View Source

Stop()

Stop all movement including turning the gun and radar. The remaining movement is saved for a call to SetResume() or Resume(). This method has no effect, if it has already been called.

This call is executed immediately by calling 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.

Declaration
public void Stop()
See Also
Stop()
SetResume()
Resume()
| Edit this page View Source

Stop(bool)

Stop all movement including turning the gun and radar. The remaining movement is saved for a call to SetResume() or Resume().

This call is executed immediately by calling 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.

Declaration
public void Stop(bool overwrite)
Parameters
Type Name Description
bool overwrite

overwrite is set to true if the movement saved by a previous call to this method or SetStop() must be overridden with the current movement. When set to false this method is identical to SetStop().

See Also
Stop()
SetResume()
Resume()
| Edit this page View Source

TurnGunLeft(double)

Turn the gun to the left (following the increasing degrees of the unit circle) until it turned the specified amount of degrees. That is, when GunTurnRemaining is 0. The amount of degrees to turn each turn is limited by MaxGunTurnRate.

This call is executed immediately by calling 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) and SetTurnGunRight(double)

Declaration
public void TurnGunLeft(double degrees)
Parameters
Type Name Description
double degrees

Is the amount of degrees to turn left. If negative, the gun will turn right. If PositiveInfinity the gun will turn left infinitely. If NegativeInfinity the gun will turn right infinitely.

See Also
SetTurnGunLeft(double)
SetTurnGunRight(double)
TurnGunRight(double)
GunTurnRemaining
GunTurnRate
| Edit this page View Source

TurnGunRight(double)

Turn the gun to the right (following the decreasing degrees of the unit circle) until it turned the specified amount of degrees. That is, when GunTurnRemaining is 0. The amount of degrees to turn each turn is limited by MaxGunTurnRate.

This call is executed immediately by calling 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) and SetTurnGunRight(double).

Declaration
public void TurnGunRight(double degrees)
Parameters
Type Name Description
double degrees

Is the amount of degrees to turn right. If negative, the gun will turn left. If PositiveInfinity the gun will turn right infinitely. If NegativeInfinity the gun will turn left infinitely.

See Also
SetTurnGunLeft(double)
SetTurnGunRight(double)
TurnGunLeft(double)
GunTurnRemaining
GunTurnRate
| Edit this page View Source

TurnLeft(double)

Turn the bot to the left (following the increasing degrees of the unit circle) until it turned the specified amount of degrees. That is, when TurnRemaining is 0. The amount of degrees to turn each turn is limited by MaxTurnRate.

This call is executed immediately by calling 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) and SetTurnRight(double)

Declaration
public void TurnLeft(double degrees)
Parameters
Type Name Description
double degrees

Is the amount of degrees to turn left. If negative, the bot will turn right. If PositiveInfinity the bot will turn left infinitely. If NegativeInfinity the bot will turn right infinitely.

See Also
SetTurnLeft(double)
SetTurnRight(double)
TurnRight(double)
TurnRemaining
TurnRate
| Edit this page View Source

TurnRadarLeft(double)

Turn the radar to the left (following the increasing degrees of the unit circle) until it turned the specified amount of degrees. That is, when RadarTurnRemaining is 0. The amount of degrees to turn each turn is limited by MaxRadarTurnRate.

This call is executed immediately by calling 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) and SetTurnRadarRight(double).

Declaration
public void TurnRadarLeft(double degrees)
Parameters
Type Name Description
double degrees

Is the amount of degrees to turn left. If negative, the radar will turn right. If PositiveInfinity the radar will turn left infinitely. If NegativeInfinity the radar will turn right infinitely.

See Also
SetTurnRadarLeft(double)
SetTurnRadarRight(double)
TurnRadarLeft(double)
RadarTurnRemaining
RadarTurnRate
| Edit this page View Source

TurnRadarRight(double)

Turn the radar to the right (following the increasing degrees of the unit circle) until it turned the specified amount of degrees. That is, when RadarTurnRemaining is 0. The amount of degrees to turn each turn is limited by MaxRadarTurnRate.

This call is executed immediately by calling 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) and SetTurnRadarRight(double).

Declaration
public void TurnRadarRight(double degrees)
Parameters
Type Name Description
double degrees

Is the amount of degrees to turn right. If negative, the radar will turn left. If PositiveInfinity the radar will turn right infinitely. If NegativeInfinity the radar will turn left infinitely.

See Also
SetTurnRadarLeft(double)
SetTurnRadarRight(double)
TurnRadarRight(double)
RadarTurnRemaining
RadarTurnRate
| Edit this page View Source

TurnRight(double)

Turn the bot to the right (following the increasing degrees of the unit circle) until it turned the specified amount of degrees. That is, when TurnRemaining is 0. The amount of degrees to turn each turn is limited by MaxTurnRate.

This call is executed immediately by calling 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) and SetTurnRight(double)

Declaration
public void TurnRight(double degrees)
Parameters
Type Name Description
double degrees

Is the amount of degrees to turn right. If negative, the bot will turn left. If PositiveInfinity the bot will turn right infinitely. If NegativeInfinity the bot will turn left infinitely.

See Also
SetTurnLeft(double)
SetTurnRight(double)
TurnLeft(double)
TurnRemaining
TurnRate
| Edit this page View Source

WaitFor(Condition)

Blocks until a condition is met, i.e. when a Test() returns true.

Declaration
public void WaitFor(Condition condition)
Parameters
Type Name Description
Condition condition
See Also
Condition
OnCustomEvent(CustomEvent)

Implements

IBot
IBaseBot
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX