robocode.control
Class BattleSpecification

java.lang.Object
  extended by robocode.control.BattleSpecification
All Implemented Interfaces:
Serializable

public class BattleSpecification
extends Object
implements Serializable

A BattleSpecification defines a battle configuration used by the RobocodeEngine.

Author:
Mathew A. Nelson (original), Flemming N. Larsen (contributor)
See Also:
Serialized Form

Constructor Summary
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.
BattleSpecification(int numRounds, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots)
          Creates a new BattleSpecification with the given number of rounds, battlefield size, and robots.
BattleSpecification(int numRounds, long inactivityTime, double gunCoolingRate, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots)
          Creates a new BattleSpecification with the given settings.
BattleSpecification(int numRounds, long inactivityTime, double gunCoolingRate, boolean hideEnemyNames, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots)
          Creates a new BattleSpecification with the given settings.
 
Method Summary
 BattlefieldSpecification getBattlefield()
          Returns the battlefield size for this battle.
 double getGunCoolingRate()
          Returns the gun cooling rate of the robots in this battle.
 boolean getHideEnemyNames()
          Returns the flag specifying if the enemy names must be hidden from events sent to robots.
 long getInactivityTime()
          Returns the allowed inactivity time for the robots in this battle.
 RobotSetup[] getInitialSetups()
          Returns the initial position and heading of each robot participating in this battle.
 int getNumRounds()
          Returns the number of rounds in this battle.
 RobotSpecification[] getRobots()
          Returns the specifications of the robots participating in this battle.
 int getSentryBorderSize()
          Returns the sentry border size for a BorderSentry that defines the how far a BorderSentry is allowed to move from the border edges measured in units.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 a BorderSentry.
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 a BorderSentry.
hideEnemyNames - flag specifying if enemy names are hidden from robots.
robots - is the robots participating in this battle.
initialSetup - is the initial position and heading of the robots, where the indices matches the indices from the robots parameter.
Since:
1.9.2.0
Method Detail

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

public BattlefieldSpecification 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 a BorderSentry 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

public RobotSpecification[] 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()

getInitialSetups

public RobotSetup[] 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 (see getRobots()).
See Also:
getRobots()


Copyright © 2015 Robocode. All Rights Reserved.