Program: 39170
Project: 39170
Buggy source:
public static <T>ArrayList<Pair<double[],double[]>> oneEval(AI ai1,AI ai2,MicroRTSInformation task,RTSFitnessFunction ff,PhysicalGameStateJFrame w){
  HashSet<Long> createdUnitIDs1=new HashSet<>();
  HashSet<Long> createdUnitIDs2=new HashSet<>();
  boolean base1Alive=false;
  boolean base2Alive=false;
  int unitDifferenceNow=0;
  coevolution=ff.getCoevolution();
  gs=task.getGameState();
  PhysicalGameState pgs=gs.getPhysicalGameState();
  boolean gameover=false;
  double averageUnitDifference=0;
  int maxCycles=1000 * (int)Math.ceil(Math.sqrt(pgs.getHeight()));
  ff.setMaxCycles(maxCycles);
  PlayerAction pa1;
  PlayerAction pa2;
  Unit currentUnit;
  boolean baseDeath1Recorded=false;
  boolean baseDeath2Recorded=false;
  int currentCycle=0;
  do {
    try {
      pa1=ai1.getAction(0,gs);
      gs.issueSafe(pa1);
    }
 catch (    Exception e1) {
      e1.printStackTrace();
      System.exit(1);
    }
    try {
      pa2=ai2.getAction(1,gs);
      gs.issueSafe(pa2);
    }
 catch (    Exception e) {
      e.printStackTrace();
      System.exit(1);
    }
    if (prog) {
      currentUnit=null;
      unitDifferenceNow=0;
      base1Alive=false;
      base2Alive=false;
      for (int i=0; i < pgs.getWidth(); i++) {
        for (int j=0; j < pgs.getHeight(); j++) {
          currentUnit=pgs.getUnitAt(i,j);
          if (currentUnit != null) {
            if (currentUnit.getPlayer() == 0)             createdUnitIDs1.add(currentUnit.getID());
 else             if (currentUnit.getPlayer() == 1)             createdUnitIDs2.add(currentUnit.getID());
            unitDifferenceNow=updateUnitDifference(currentUnit,unitDifferenceNow);
            if (currentUnit.getType().name.equals("String_Node_Str")) {
              updateHarvestingEfficiency(currentUnit,coevolution,task);
            }
            if (currentUnit.getType().name.equals("String_Node_Str")) {
              base1Alive=base1Alive || updateBaseIsAlive(currentUnit,1);
              base2Alive=base2Alive || updateBaseIsAlive(currentUnit,2);
            }
          }
        }
      }
      MiscUtil.waitForReadStringAndEnterKeyPress();
      if ((!base1Alive) && (!baseDeath1Recorded)) {
        task.setBaseUpTime(gs.getTime(),1);
        baseDeath1Recorded=true;
      }
      if (!base2Alive && !baseDeath2Recorded && coevolution) {
        task.setBaseUpTime(gs.getTime(),2);
        baseDeath2Recorded=true;
      }
      currentCycle++;
      averageUnitDifference+=(unitDifferenceNow - averageUnitDifference) / (1.0 * currentCycle);
    }
    gameover=gs.cycle();
    if (CommonConstants.watch)     w.repaint();
  }
 while (!gameover && gs.getTime() < maxCycles);
  ff.setGameEndTime(gs.getTime());
  int terminalUnits1=0;
  int terminalUnits2=0;
  for (int i=0; i < pgs.getWidth(); i++) {
    for (int j=0; j < pgs.getHeight(); j++) {
      currentUnit=pgs.getUnitAt(i,j);
      if (currentUnit != null) {
        if (currentUnit.getPlayer() == 0)         terminalUnits1++;
 else         if (currentUnit.getPlayer() == 1)         terminalUnits2++;
      }
    }
  }
  task.setPercentEnemiesDestroyed(((createdUnitIDs2.size() - terminalUnits2) * 100) / createdUnitIDs2.size(),1);
  if (coevolution)   task.setPercentEnemiesDestroyed(((createdUnitIDs1.size() - terminalUnits1) * 100) / createdUnitIDs1.size(),2);
  task.setAvgUnitDiff(averageUnitDifference);
  if (CommonConstants.watch)   w.dispose();
  return ff.getFitness(gs);
}

Fixed version (ground truth):
public static <T>ArrayList<Pair<double[],double[]>> oneEval(AI ai1,AI ai2,MicroRTSInformation task,RTSFitnessFunction ff,PhysicalGameStateJFrame w){
  HashSet<Long> createdUnitIDs1=new HashSet<>();
  HashSet<Long> createdUnitIDs2=new HashSet<>();
  boolean base1Alive=false;
  boolean base2Alive=false;
  int unitDifferenceNow=0;
  coevolution=ff.getCoevolution();
  gs=task.getGameState();
  PhysicalGameState pgs=gs.getPhysicalGameState();
  boolean gameover=false;
  double averageUnitDifference=0;
  int maxCycles=1000 * (int)Math.ceil(Math.sqrt(pgs.getHeight()));
  ff.setMaxCycles(maxCycles);
  PlayerAction pa1;
  PlayerAction pa2;
  Unit currentUnit;
  boolean baseDeath1Recorded=false;
  boolean baseDeath2Recorded=false;
  int currentCycle=0;
  do {
    try {
      pa1=ai1.getAction(0,gs);
      gs.issueSafe(pa1);
    }
 catch (    Exception e1) {
      e1.printStackTrace();
      System.exit(1);
    }
    try {
      pa2=ai2.getAction(1,gs);
      gs.issueSafe(pa2);
    }
 catch (    Exception e) {
      e.printStackTrace();
      System.exit(1);
    }
    pgs=gs.getPhysicalGameState();
    if (prog) {
      currentUnit=null;
      unitDifferenceNow=0;
      base1Alive=false;
      base2Alive=false;
      for (int i=0; i < pgs.getWidth(); i++) {
        for (int j=0; j < pgs.getHeight(); j++) {
          currentUnit=pgs.getUnitAt(i,j);
          if (currentUnit != null) {
            if (currentUnit.getPlayer() == 0)             createdUnitIDs1.add(currentUnit.getID());
 else             if (currentUnit.getPlayer() == 1)             createdUnitIDs2.add(currentUnit.getID());
            unitDifferenceNow=updateUnitDifference(currentUnit,unitDifferenceNow);
            if (currentUnit.getType().name.equals("String_Node_Str")) {
              updateHarvestingEfficiency(currentUnit,coevolution,task);
            }
            if (currentUnit.getType().name.equals("String_Node_Str")) {
              base1Alive=base1Alive || updateBaseIsAlive(currentUnit,1);
              base2Alive=base2Alive || updateBaseIsAlive(currentUnit,2);
            }
          }
        }
      }
      if ((!base1Alive) && (!baseDeath1Recorded)) {
        task.setBaseUpTime(gs.getTime(),1);
        baseDeath1Recorded=true;
      }
      if (!base2Alive && !baseDeath2Recorded && coevolution) {
        task.setBaseUpTime(gs.getTime(),2);
        baseDeath2Recorded=true;
      }
      currentCycle++;
      averageUnitDifference+=(unitDifferenceNow - averageUnitDifference) / (1.0 * currentCycle);
    }
    gameover=gs.cycle();
    if (CommonConstants.watch)     w.repaint();
  }
 while (!gameover && gs.getTime() < maxCycles);
  ff.setGameEndTime(gs.getTime());
  int terminalUnits1=0;
  int terminalUnits2=0;
  if (prog) {
    for (int i=0; i < pgs.getWidth(); i++) {
      for (int j=0; j < pgs.getHeight(); j++) {
        currentUnit=pgs.getUnitAt(i,j);
        if (currentUnit != null) {
          if (currentUnit.getPlayer() == 0)           terminalUnits1++;
 else           if (currentUnit.getPlayer() == 1)           terminalUnits2++;
        }
      }
    }
    task.setPercentEnemiesDestroyed(((createdUnitIDs2.size() - terminalUnits2) * 100) / createdUnitIDs2.size(),1);
    if (coevolution)     task.setPercentEnemiesDestroyed(((createdUnitIDs1.size() - terminalUnits1) * 100) / createdUnitIDs1.size(),2);
    task.setAvgUnitDiff(averageUnitDifference);
  }
  if (CommonConstants.watch)   w.dispose();
  return ff.getFitness(gs);
}