Package dev.robocode.tankroyale.botapi
Class BotState
- java.lang.Object
-
- dev.robocode.tankroyale.botapi.BotState
-
public final class BotState extends java.lang.Object
Represents the current bot state.
-
-
Constructor Summary
Constructors Constructor Description BotState(boolean isDroid, double energy, double x, double y, double direction, double gunDirection, double radarDirection, double radarSweep, double speed, double turnRate, double gunTurnRate, double radarTurnRate, double gunHeat, int enemyCount, java.awt.Color bodyColor, java.awt.Color turretColor, java.awt.Color radarColor, java.awt.Color bulletColor, java.awt.Color scanColor, java.awt.Color tracksColor, java.awt.Color gunColor, boolean isDebuggingEnabled)
Initializes a new instance of the BotState class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Color
getBodyColor()
Returns the color the body.java.awt.Color
getBulletColor()
Returns the color of the bullets when fired.double
getDirection()
Returns the driving direction of the bot in degrees.int
getEnemyCount()
Returns the number of enemy bots left on the battlefield.double
getEnergy()
Returns the energy level of the bot.java.awt.Color
getGunColor()
Returns the color of the gun.double
getGunDirection()
Returns the gun direction of the bot in degrees.double
getGunHeat()
Returns the gun heat.double
getGunTurnRate()
Returns the turn rate of the gun in degrees per turn (can be positive and negative).java.awt.Color
getRadarColor()
Returns the color of the radar.double
getRadarDirection()
Returns the radar direction of the bot in degrees.double
getRadarSweep()
Returns the radar sweep angle in degrees, i.e.double
getRadarTurnRate()
Returns the turn rate of the radar in degrees per turn (can be positive and negative).java.awt.Color
getScanColor()
Returns the color of the scan arc.double
getSpeed()
Returns the speed measured in units per turn.java.awt.Color
getTracksColor()
Returns the color of the tracks.double
getTurnRate()
Returns the turn rate of the body in degrees per turn (can be positive and negative).java.awt.Color
getTurretColor()
Returns the color of the gun turret.double
getX()
Returns the X coordinate of the bot, which is in the center of the bot.double
getY()
Returns the Y coordinate of the bot, which is in the center of the bot.boolean
isDebuggingEnabled()
Checks if graphical debugging is enabled.boolean
isDroid()
Checks if the bot is a droid or not.
-
-
-
Constructor Detail
-
BotState
public BotState(boolean isDroid, double energy, double x, double y, double direction, double gunDirection, double radarDirection, double radarSweep, double speed, double turnRate, double gunTurnRate, double radarTurnRate, double gunHeat, int enemyCount, java.awt.Color bodyColor, java.awt.Color turretColor, java.awt.Color radarColor, java.awt.Color bulletColor, java.awt.Color scanColor, java.awt.Color tracksColor, java.awt.Color gunColor, boolean isDebuggingEnabled)
Initializes a new instance of the BotState class.- Parameters:
isDroid
- is the flag specifying if the bot is a droid.energy
- is the energy level.x
- is the X coordinate.y
- is the Y coordinate.direction
- is the driving direction in degrees.gunDirection
- is the gun direction in degrees.radarDirection
- is the radar direction in degrees.radarSweep
- is the radar sweep angle in degrees.speed
- is the speed measured in units per turn.turnRate
- is the turn rate of the body in degrees per turn.gunTurnRate
- is the turn rate of the gun in degrees per turn.radarTurnRate
- is the turn rate of the radar in degrees per turn.gunHeat
- is the gun heat.enemyCount
- is tbe number of enemies leftbodyColor
- is the body color.turretColor
- is the gun turret color.radarColor
- is the radar color.bulletColor
- is the bullet color.scanColor
- is the scan arc color.tracksColor
- is the tracks color.gunColor
- is the gun color.isDebuggingEnabled
- is a flag indicating if graphical debugging is enabled.
-
-
Method Detail
-
isDroid
public boolean isDroid()
Checks if the bot is a droid or not.- Returns:
true
if the bot is a droid;false
otherwise.
-
getEnergy
public double getEnergy()
Returns the energy level of the bot. The energy level is typically starting at 100. The bot gains more energy when hitting other bots, and loses energy by getting hit and when spending energy on firing bullets. When the energy reaches 0, the bot becomes disabled and will not be able to take any new action. It might become active again, if one of its bullets hit another bot, meaning that the bot gains new energy.- Returns:
- The energy level.
-
getX
public double getX()
Returns the X coordinate of the bot, which is in the center of the bot.- Returns:
- The X coordinate.
-
getY
public double getY()
Returns the Y coordinate of the bot, which is in the center of the bot.- Returns:
- The Y coordinate.
-
getDirection
public double getDirection()
Returns the driving direction of the bot in degrees.- Returns:
- The driving direction.
-
getGunDirection
public double getGunDirection()
Returns the gun direction of the bot in degrees.- Returns:
- The gun direction.
-
getRadarDirection
public double getRadarDirection()
Returns the radar direction of the bot in degrees.- Returns:
- The radar direction.
-
getRadarSweep
public double getRadarSweep()
Returns the radar sweep angle in degrees, i.e. delta angle between previous and current radar direction.- Returns:
- The radar sweep angle.
-
getSpeed
public double getSpeed()
Returns the speed measured in units per turn.- Returns:
- The speed.
-
getTurnRate
public double getTurnRate()
Returns the turn rate of the body in degrees per turn (can be positive and negative).- Returns:
- the turn rate.
-
getGunTurnRate
public double getGunTurnRate()
Returns the turn rate of the gun in degrees per turn (can be positive and negative).- Returns:
- the gun turn rate.
-
getRadarTurnRate
public double getRadarTurnRate()
Returns the turn rate of the radar in degrees per turn (can be positive and negative).- Returns:
- the radar turn rate.
-
getGunHeat
public double getGunHeat()
Returns the gun heat. When firing the gun, it will be heated up. The gun will need to cool down before it can fire another bullet. When the gun heat is zero, the gun will be able to fire again.- Returns:
- The gun heat.
-
getEnemyCount
public int getEnemyCount()
Returns the number of enemy bots left on the battlefield.- Returns:
- the number of enemy bots left on the battlefield.
-
getBodyColor
public java.awt.Color getBodyColor()
Returns the color the body.- Returns:
- The color the body.
-
getTurretColor
public java.awt.Color getTurretColor()
Returns the color of the gun turret.- Returns:
- The color of the gun turret.
-
getRadarColor
public java.awt.Color getRadarColor()
Returns the color of the radar.- Returns:
- The color of the radar.
-
getBulletColor
public java.awt.Color getBulletColor()
Returns the color of the bullets when fired.- Returns:
- The color of the bullets when fired.
-
getScanColor
public java.awt.Color getScanColor()
Returns the color of the scan arc.- Returns:
- The color of the scan arc.
-
getTracksColor
public java.awt.Color getTracksColor()
Returns the color of the tracks.- Returns:
- The color of the tracks.
-
getGunColor
public java.awt.Color getGunColor()
Returns the color of the gun.- Returns:
- The color of the gun.
-
isDebuggingEnabled
public boolean isDebuggingEnabled()
Checks if graphical debugging is enabled.- Returns:
true
if graphical debugging is enabled;false
otherwise.
-
-