private robocode.control.RobotSetup MapRobotSetup(RobotSetup setup) { return new robocode.control.RobotSetup(setup.X, setup.Y, setup.Heading); }
/// <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.RobotSetup[] MapInitialSetups(RobotSetup[] setups) { if (setups == null) { return null; } robocode.control.RobotSetup[] mappedSetups = new robocode.control.RobotSetup[setups.Length]; for (int i = 0; i < setups.Length; i++) { mappedSetups[i] = MapRobotSetup(setups[i]); } return mappedSetups; }