/// <summary> /// Creates a new BattleSpecification with the given settings. /// </summary> /// <param name="numRounds">The number of rounds in this battle.</param> /// <param name="inactivityTime">The inactivity time allowed for the robots before /// they will loose energy.</param> /// <param name="gunCoolingRate">The gun cooling rate for the robots.</param> /// <param name="battlefieldSize">The battlefield size.</param> /// <param name="robots">The robots participating in this battle.</param> public BattleSpecification(int numRounds, long inactivityTime, double gunCoolingRate, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots) { this.numRounds = numRounds; this.inactivityTime = inactivityTime; this.gunCoolingRate = gunCoolingRate; this.battlefieldWidth = battlefieldSize.Width; this.battlefieldHeight = battlefieldSize.Height; this.robots = robots; }
/// <summary> /// Creates a new BattleSpecification with the given settings. /// </summary> /// <param name="battlefieldSize">The battlefield size.</param> /// <param name="numRounds">The number of rounds in this battle.</param> /// <param name="inactivityTime">The inactivity time allowed for the robots before /// they will loose energy.</param> /// <param name="gunCoolingRate">The gun cooling rate for the robots.</param> /// <param name="sentryBorderSize">The sentry border size for a <see cref="Robocode.IBorderSentry">BorderSentry</see>.</param> /// <param name="hideEnemyNames">Flag specifying if enemy names are hidden from robots.</param> /// <param name="robots">The robots participating in this battle.</param> public BattleSpecification(BattlefieldSpecification battlefieldSize, int numRounds, long inactivityTime, double gunCoolingRate, int sentryBorderSize, bool hideEnemyNames, RobotSpecification[] robots) : this(battlefieldSize, numRounds, inactivityTime, gunCoolingRate, 100, hideEnemyNames, robots, null) { }
/// <summary> /// Creates a new BattleSpecification with the given settings. /// </summary> /// <param name="numRounds">The number of rounds in this battle.</param> /// <param name="inactivityTime">The inactivity time allowed for the robots before /// they will loose energy.</param> /// <param name="gunCoolingRate">The gun cooling rate for the robots.</param> /// <param name="battlefieldSize">The battlefield size.</param> /// <param name="robots">The robots participating in this battle.</param> public BattleSpecification(int numRounds, long inactivityTime, double gunCoolingRate, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots) : this(numRounds, inactivityTime, gunCoolingRate, false, battlefieldSize, robots) { }
/// <summary> /// 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. /// </summary> /// <param name="numRounds">The number of rounds in this battle.</param> /// <param name="battlefieldSize">The battlefield size.</param> /// <param name="robots">The robots participating in this battle.</param> public BattleSpecification(int numRounds, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots) : this(numRounds, 450, .1, battlefieldSize, robots) { }
/// <summary> /// Creates a new BattleSpecification with the given settings. /// </summary> /// <param name="battlefieldSize">The battlefield size.</param> /// <param name="numRounds">The number of rounds in this battle.</param> /// <param name="inactivityTime">The inactivity time allowed for the robots before /// they will loose energy.</param> /// <param name="gunCoolingRate">The gun cooling rate for the robots.</param> /// <param name="sentryBorderSize">The sentry border size for a <see cref="Robocode.IBorderSentry">BorderSentry</see>.</param> /// <param name="hideEnemyNames">Flag specifying if enemy names are hidden from robots.</param> /// <param name="robots">The robots participating in this battle.</param> /// <param name="initialSetups">The initial position and heading of the robots, where the indices matches the indices from the <paramref name="robots"/>.</param> public BattleSpecification(BattlefieldSpecification battlefieldSize, int numRounds, long inactivityTime, double gunCoolingRate, int sentryBorderSize, bool hideEnemyNames, RobotSpecification[] robots, RobotSetup[] initialSetups) { if (battlefieldSize == null) { throw new ArgumentException("battlefieldSize cannot be null"); } if (robots == null) { throw new ArgumentException("robots cannot be null"); } if (robots.Length < 1) { throw new ArgumentException("robots.Length must be > 0"); } if (initialSetups != null && initialSetups.Length != robots.Length) { throw new ArgumentException("initialSetups.Length must be == robots.Length"); } if (numRounds < 1) { throw new ArgumentException("numRounds must be >= 1"); } if (inactivityTime < 1) { throw new ArgumentException("inactivityTime must be >= 1"); } if (gunCoolingRate < 0.1) { throw new ArgumentException("inactivityTime must be >= 0.1"); } if (sentryBorderSize < 50) { throw new ArgumentException("sentryBorderSize must be >= 50"); } this.battlefieldWidth = battlefieldSize.Width; this.battlefieldHeight = battlefieldSize.Height; this.numRounds = numRounds; this.inactivityTime = inactivityTime; this.gunCoolingRate = gunCoolingRate; this.sentryBorderSize = sentryBorderSize; this.hideEnemyNames = hideEnemyNames; this.robots = robots; this.initialSetups = initialSetups; }
private robocode.control.RobotSpecification MapRobotSpecification(RobotSpecification spec) { return spec.robotSpecification; }
private robocode.control.RobotSpecification[] MapRobotSpecifications(RobotSpecification[] specifications) { if (specifications == null) { return null; } robocode.control.RobotSpecification[] mappedSpecifications = new robocode.control.RobotSpecification[specifications.Length]; for (int i = 0; i < specifications.Length; i++) { mappedSpecifications[i] = MapRobotSpecification(specifications[i]); } return mappedSpecifications; }
/// <summary> /// Creates a new BattleSpecification with the given settings. /// </summary> /// <param name="numRounds">The number of rounds in this battle.</param> /// <param name="inactivityTime">The inactivity time allowed for the robots before /// they will loose energy.</param> /// <param name="gunCoolingRate">The gun cooling rate for the robots.</param> /// <param name="sentryBorderSize">The sentry border size for a <see cref="Robocode.IBorderSentry">BorderSentry</see>.</param> /// <param name="hideEnemyNames">Flag specifying if enemy names are hidden from robots.</param> /// <param name="battlefieldSize">The battlefield size.</param> /// <param name="robots">The robots participating in this battle.</param> public BattleSpecification(int numRounds, long inactivityTime, double gunCoolingRate, int sentryBorderSize, bool hideEnemyNames, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots) { this.numRounds = numRounds; this.inactivityTime = inactivityTime; this.gunCoolingRate = gunCoolingRate; this.sentryBorderSize = sentryBorderSize; this.hideEnemyNames = hideEnemyNames; this.battlefieldWidth = battlefieldSize.Width; this.battlefieldHeight = battlefieldSize.Height; this.robots = robots; }