Package robocode.control
Class BattleSpecification
java.lang.Object
robocode.control.BattleSpecification
- All Implemented Interfaces:
Serializable
A BattleSpecification defines a battle configuration used by the
RobocodeEngine
.- Author:
- Mathew A. Nelson (original), Flemming N. Larsen (contributor)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBattleSpecification
(int numRounds, long inactivityTime, double gunCoolingRate, boolean hideEnemyNames, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots) Creates a new BattleSpecification with the given settings.BattleSpecification
(int numRounds, long inactivityTime, double gunCoolingRate, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots) Creates a new BattleSpecification with the given settings.BattleSpecification
(int numRounds, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots) Creates a new BattleSpecification with the given number of rounds, battlefield size, and robots.BattleSpecification
(BattlefieldSpecification battlefieldSize, int numRounds, long inactivityTime, double gunCoolingRate, int sentryBorderSize, boolean hideEnemyNames, RobotSpecification[] robots) Creates a new BattleSpecification with the given settings.BattleSpecification
(BattlefieldSpecification battlefieldSize, int numRounds, long inactivityTime, double gunCoolingRate, int sentryBorderSize, boolean hideEnemyNames, RobotSpecification[] robots, RobotSetup[] initialSetups) Creates a new BattleSpecification with the given settings. -
Method Summary
Modifier and TypeMethodDescriptionReturns the battlefield size for this battle.double
Returns the gun cooling rate of the robots in this battle.boolean
Returns the flag specifying if the enemy names must be hidden from events sent to robots.long
Returns the allowed inactivity time for the robots in this battle.Returns the initial position and heading of each robot participating in this battle.int
Returns the number of rounds in this battle.Returns the specifications of the robots participating in this battle.int
Returns the sentry border size for aBorderSentry
that defines the how far a BorderSentry is allowed to move from the border edges measured in units.
Hence, the sentry border size defines the width/range of the border area surrounding the battlefield that border sentry robots cannot leave (they must stay in the border area), but it also define the distance from the border edges where border sentry robots are allowed/able to make damage to robots entering this border area.
-
Constructor Details
-
BattleSpecification
public BattleSpecification(int numRounds, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots) Creates a new BattleSpecification with the given number of rounds, battlefield size, and robots. Inactivity time for the robots defaults to 450, and the gun cooling rate defaults to 0.1.- Parameters:
numRounds
- is the number of rounds in this battle.battlefieldSize
- is the battlefield size.robots
- is the robots participating in this battle.
-
BattleSpecification
public BattleSpecification(int numRounds, long inactivityTime, double gunCoolingRate, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots) Creates a new BattleSpecification with the given settings.- Parameters:
numRounds
- is the number of rounds in this battle.inactivityTime
- is the inactivity time allowed for the robots before they will loose energy.gunCoolingRate
- is the gun cooling rate for the robots.battlefieldSize
- is the battlefield size.robots
- is the robots participating in this battle.
-
BattleSpecification
public BattleSpecification(int numRounds, long inactivityTime, double gunCoolingRate, boolean hideEnemyNames, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots) Creates a new BattleSpecification with the given settings.- Parameters:
numRounds
- is the number of rounds in this battle.inactivityTime
- is the inactivity time allowed for the robots before they will loose energy.gunCoolingRate
- is the gun cooling rate for the robots.hideEnemyNames
- flag specifying if enemy names are hidden from robots.battlefieldSize
- is the battlefield size.robots
- is the robots participating in this battle.- Since:
- 1.7.3
-
BattleSpecification
public BattleSpecification(BattlefieldSpecification battlefieldSize, int numRounds, long inactivityTime, double gunCoolingRate, int sentryBorderSize, boolean hideEnemyNames, RobotSpecification[] robots) Creates a new BattleSpecification with the given settings.- Parameters:
battlefieldSize
- is the battlefield size.numRounds
- is the number of rounds in this battle.inactivityTime
- is the inactivity time allowed for the robots before they will loose energy.gunCoolingRate
- is the gun cooling rate for the robots.sentryBorderSize
- is the sentry border size for aBorderSentry
.hideEnemyNames
- flag specifying if enemy names are hidden from robots.robots
- is the robots participating in this battle.- Since:
- 1.9.0.0
-
BattleSpecification
public BattleSpecification(BattlefieldSpecification battlefieldSize, int numRounds, long inactivityTime, double gunCoolingRate, int sentryBorderSize, boolean hideEnemyNames, RobotSpecification[] robots, RobotSetup[] initialSetups) Creates a new BattleSpecification with the given settings.- Parameters:
battlefieldSize
- is the battlefield size.numRounds
- is the number of rounds in this battle.inactivityTime
- is the inactivity time allowed for the robots before they will loose energy.gunCoolingRate
- is the gun cooling rate for the robots.sentryBorderSize
- is the sentry border size for aBorderSentry
.hideEnemyNames
- flag specifying if enemy names are hidden from robots.robots
- is the robots participating in this battle.initialSetups
- is the initial position and heading of the robots, where the indices matches the indices from therobots
parameter.- Since:
- 1.9.2.0
-
-
Method Details
-
getInactivityTime
public long getInactivityTime()Returns the allowed inactivity time for the robots in this battle.- Returns:
- the allowed inactivity time for the robots in this battle.
-
getGunCoolingRate
public double getGunCoolingRate()Returns the gun cooling rate of the robots in this battle.- Returns:
- the gun cooling rate of the robots in this battle.
-
getBattlefield
Returns the battlefield size for this battle.- Returns:
- the battlefield size for this battle.
-
getNumRounds
public int getNumRounds()Returns the number of rounds in this battle.- Returns:
- the number of rounds in this battle.
-
getHideEnemyNames
public boolean getHideEnemyNames()Returns the flag specifying if the enemy names must be hidden from events sent to robots.- Returns:
true
if the enemy names must be hidden;false
otherwise.- Since:
- 1.7.3
-
getSentryBorderSize
public int getSentryBorderSize()Returns the sentry border size for aBorderSentry
that defines the how far a BorderSentry is allowed to move from the border edges measured in units.
Hence, the sentry border size defines the width/range of the border area surrounding the battlefield that border sentry robots cannot leave (they must stay in the border area), but it also define the distance from the border edges where border sentry robots are allowed/able to make damage to robots entering this border area.- Returns:
- the border size in units/pixels that border sentry robots are restricted to.
- Since:
- 1.9.0.0
-
getRobots
Returns the specifications of the robots participating in this battle.- Returns:
- an array of
RobotSpecification
instances - one entry for each robot. - See Also:
-
getInitialSetups
Returns the initial position and heading of each robot participating in this battle.- Returns:
- an array of
RobotSetup
instances - one entry for each robot. The the indices of this array matches the array indices from the robot specifications (seegetRobots()
). - See Also:
-