Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9966


Ignore:
Timestamp:
09/16/13 10:31:18 (11 years ago)
Author:
ascheibe
Message:

#2069 improved robot detection in BattleRunner

Location:
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3
Files:
4 edited

Legend:

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

    r9947 r9966  
    5656        engine.addBattleListener(new BattleObserver());       
    5757
    58      // setup the battle specification 
    59         for (String s : robots)
    60             bots += s + ", ";
    61         bots = bots.substring(0, bots.length() - 1);
     58    BattlefieldSpecification battlefield = new BattlefieldSpecification(800, 600);
     59        RobotSpecification[] all = engine.getLocalRepository();
     60    List<RobotSpecification> selectedRobots = new ArrayList<RobotSpecification>();
    6261   
    63         BattlefieldSpecification battlefield = new BattlefieldSpecification(800, 600);
    64         RobotSpecification[] selectedRobots = engine.getLocalRepository(bots);
    65 
    66         for (int i = 1; i < selectedRobots.length; i++) {
    67             BattleSpecification battleSpec = new BattleSpecification(numberOfRounds, battlefield,
    68       new RobotSpecification[] { selectedRobots[0], selectedRobots[i] });
     62    for(RobotSpecification rs : all) {
     63      for(String r : robots) {
     64        if(r.equals(rs.getClassName())) {
     65          selectedRobots.add(rs);       
     66        }     
     67      }
     68    }   
     69   
     70    for (int i = 1; i < selectedRobots.size(); i++) {
     71      BattleSpecification battleSpec = new BattleSpecification(numberOfRounds, battlefield,
     72      new RobotSpecification[] { selectedRobots.get(0), selectedRobots.get(i) });
    6973
    7074            // run our specified battle and wait till the battle finishes
  • branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Interpreter.cs

    r9962 r9966  
    7676      evaluateCodeInfo.FileName = "cmd.exe";
    7777      evaluateCodeInfo.Arguments = "/C java -cp " + battleRunnerPath + ";" + robocodeCoreJar + ";" + robocodeJar +
    78                                   ";" + picocontainerJar + ";" + " BattleRunner Evaluation." + robotName + "* " + path;
     78                                  ";" + picocontainerJar + ";" + " BattleRunner Evaluation." + robotName + " " + path;
    7979
    8080      if (showUI) {
     
    8585
    8686      foreach (var enemy in enemies.CheckedItems)
    87         evaluateCodeInfo.Arguments += enemy.Value + "* ";
     87        evaluateCodeInfo.Arguments += enemy.Value + " ";
    8888
    8989      evaluateCodeInfo.RedirectStandardOutput = true;
Note: See TracChangeset for help on using the changeset viewer.