Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/11/13 15:21:01 (11 years ago)
Author:
jkarder
Message:

#2069:

  • modified the RobocodeProblem to extract all robots in robocode directory
  • modified the battle runner to take a number of enemies that should be battled
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/External Evaluator/BattleRunner.java

    r9926 r9947  
    2727//
    2828public class BattleRunner {
    29     static String[] defaultRobots = new String[] {
    30         "Evaluation.BestSolution*",
    31         "sample.Corners",
    32         "sample.Crazy",
    33         "sample.Fire",
    34         "sample.TrackFire",
    35         "sample.Walls",
    36         "sample.SpinBot",
    37         "sample.SittingDuck"
    38     };
    3929    public static String player = "Evaluation.output*";   
    4030    public static List<Double> score = new ArrayList<Double>();
     
    4535  // The fourth argument is the number of rounds.
    4636  public static void main(String[] args) {
     37    if (args.length < 5)
     38      System.exit(-1); 
     39
    4740    String roboCodePath = "C:\\robocode";
    4841    Boolean visible = false;   
    4942    String bots = "";
    5043    int numberOfRounds = 3;
    51         String[] robots = new String[defaultRobots.length];
    52         robots = defaultRobots.clone();   
    53  
    54     if (args.length == 1)
    55         {
    56             robots[0] = args[0];           
    57       player = args[0];           
    58         }
    59         else if (args.length == 2)
    60         {
    61             robots[0] = args[0];           
    62       player = args[0];       
    63       roboCodePath = args[1];           
    64         }
    65     else if (args.length == 3)
    66         {
    67             robots[0] = args[0];           
    68       player = args[0];       
    69       roboCodePath = args[1];
    70             visible = Boolean.valueOf(args[2]);
    71         }
    72     else if (args.length == 4)
    73         {
    74             robots[0] = args[0];           
    75       player = args[0];       
    76       roboCodePath = args[1];
    77             visible = Boolean.valueOf(args[2]);
    78       numberOfRounds = Integer.valueOf(args[3]);
    79         }
    80         else
    81     {
    82             System.exit(-1);
    83     }   
     44        String[] robots = new String[1 + args.length - 4];     
     45
     46    player = robots[0] = args[0];       
     47    roboCodePath = args[1];
     48    visible = Boolean.valueOf(args[2]);
     49    numberOfRounds = Integer.valueOf(args[3]);
     50    for (int i = 4; i < args.length; i++)
     51      robots[i - 3] = args[i];
    8452
    8553        RobocodeEngine.setLogMessagesEnabled(false);
Note: See TracChangeset for help on using the changeset viewer.