Free cookie consent management tool by TermsFeed Policy Generator

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

#2069 improved robot detection in BattleRunner

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.