nus-yam/ex-repair huggingface dataset:
Program: 39239
Project: 39239
Buggy source:
public static void linePlot(DrawingPanel panel,double min,double max,ArrayList<Double> scores,Color color){
  Graphics g=panel.getGraphics();
  g.setColor(Color.black);
  g.drawLine(OFFSET,OFFSET,OFFSET,BROWSE_DIM - OFFSET);
  g.drawLine(OFFSET,BROWSE_DIM - OFFSET,BROWSE_DIM - OFFSET,BROWSE_DIM - OFFSET);
  double last=scores.get(0);
  double maxRange=Math.max(max,max - min);
  double lowerMin=Math.min(0,min);
  for (int i=1; i < scores.size(); i++) {
    g.setColor(color);
    int x1=OFFSET + scale((double)(i - 1),(double)scores.size(),0);
    int y1=OFFSET + invert(last,maxRange,lowerMin);
    int x2=OFFSET + scale((double)i,(double)scores.size(),0);
    int y2=OFFSET + invert(scores.get(i),maxRange,lowerMin);
    g.drawLine(x1,y1,x2,y2);
    g.setColor(Color.black);
    g.drawString("String_Node_Str" + max,OFFSET / 2,OFFSET / 2);
    g.drawString("String_Node_Str" + lowerMin,OFFSET / 2,BROWSE_DIM - (OFFSET / 2));
    last=scores.get(i);
  }
}

Fixed version (ground truth):
public static void linePlot(DrawingPanel panel,double min,double max,ArrayList<Double> scores,Color color){
  Graphics g=panel.getGraphics();
  int height=panel.getFrame().getHeight() - 50;
  int width=panel.getFrame().getWidth();
  g.setColor(Color.black);
  g.drawLine(OFFSET,OFFSET,OFFSET,height - OFFSET);
  g.drawLine(OFFSET,height - OFFSET,width - OFFSET,height - OFFSET);
  double last=scores.get(0);
  double maxRange=Math.max(max,max - min);
  double lowerMin=Math.min(0,min);
  for (int i=1; i < scores.size(); i++) {
    g.setColor(color);
    int x1=OFFSET + scale((double)(i - 1),(double)scores.size(),0,width);
    int y1=OFFSET + invert(last,maxRange,lowerMin,height);
    int x2=OFFSET + scale((double)i,(double)scores.size(),0,width);
    int y2=OFFSET + invert(scores.get(i),maxRange,lowerMin,height);
    g.drawLine(x1,y1,x2,y2);
    g.setColor(Color.black);
    last=scores.get(i);
  }
  g.drawString("String_Node_Str" + max,OFFSET / 2,OFFSET / 2);
  g.drawString("String_Node_Str" + lowerMin,OFFSET / 2,height - (OFFSET / 2));
}
Program: 39240
Project: 39240
Buggy source:
public static int invert(double y,double max,double min){
  return (BROWSE_DIM - (2 * OFFSET)) - scale(y,max,min);
}

Fixed version (ground truth):
public static int invert(double y,double max,double min,int totalHeight){
  return (totalHeight - (2 * OFFSET)) - scale(y,max,min,totalHeight);
}
Program: 39241
Project: 39241
Buggy source:
public static int scale(double x,double max,double min){
  return (int)(((x - min) / max) * (BROWSE_DIM - (2 * OFFSET)));
}

Fixed version (ground truth):
public static int scale(double x,double max,double min,int totalWidth){
  return (int)(((x - min) / max) * (totalWidth - (2 * OFFSET)));
}
Program: 39242
Project: 39242
Buggy source:
/** 
 * Tests creation of list of nodes in substrates. Order of substrates is not imortant as long as mapping is accurate
 */
@Test public void testCreateSubstrateNodesSlow(){
  ArrayList<NodeGene> nodes=hcppn.createSubstrateNodes(hcppn.getCPPN(),subs);
  assertEquals(nodes.size(),subs.get(sub1Index).getSize().t1 * subs.get(sub1Index).getSize().t2 + subs.get(sub2Index).getSize().t1 * subs.get(sub2Index).getSize().t2);
  assertEquals(hcppn.innovationID,nodes.size());
  tearDown();
}

Fixed version (ground truth):
/** 
 * Tests creation of list of nodes in substrates. Order of substrates is not imortant as long as mapping is accurate
 */
@Test public void testCreateSubstrateNodesSlow(){
  ArrayList<NodeGene> nodes=hcppn.createSubstrateNodes((HyperNEATTask)MMNEAT.task,hcppn.getCPPN(),subs);
  assertEquals(nodes.size(),subs.get(sub1Index).getSize().t1 * subs.get(sub1Index).getSize().t2 + subs.get(sub2Index).getSize().t1 * subs.get(sub2Index).getSize().t2);
  assertEquals(hcppn.innovationID,nodes.size());
  tearDown();
}
Program: 39243
Project: 39243
Buggy source:
private void colorScents(){
  for (int agent=0; agent < predScents.length; agent++) {
    for (int m=0; m < predScents[agent].length; m++) {
      for (int x=0; x < predScents[agent][m].length; x++) {
        for (int y=0; y < predScents[agent][m][x].length; y++) {
          if (predScents[agent][m][x][y] > 0.0001) {
            int r=(int)(predColors[agent][m][0] * (1 - predScents[agent][m][x][y]));
            int g=(int)(predColors[agent][m][1] * (1 - predScents[agent][m][x][y]));
            int b=(int)(predColors[agent][m][2] * (1 - predScents[agent][m][x][y]));
            Color c=new Color(r,g,b);
            bufferGraphics.setColor(c);
            bufferGraphics.fillRect(x(x) + 1,(y(y) - CELL_SIZE) + 1,CELL_SIZE - 1,CELL_SIZE - 1);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Fill cells with color based on the scent strengths
 */
private void colorScents(){
  for (int agent=0; agent < predScents.length; agent++) {
    for (int m=0; m < predScents[agent].length; m++) {
      for (int x=0; x < predScents[agent][m].length; x++) {
        for (int y=0; y < predScents[agent][m][x].length; y++) {
          if (predScents[agent][m][x][y] > 0.0001) {
            int r=(int)(predColors[agent][m][0] * (1 - predScents[agent][m][x][y]));
            int g=(int)(predColors[agent][m][1] * (1 - predScents[agent][m][x][y]));
            int b=(int)(predColors[agent][m][2] * (1 - predScents[agent][m][x][y]));
            Color c=new Color(r,g,b);
            bufferGraphics.setColor(c);
            bufferGraphics.fillRect(x(x) + 1,(y(y) - CELL_SIZE) + 1,CELL_SIZE - 1,CELL_SIZE - 1);
          }
        }
      }
    }
  }
}
Program: 39244
Project: 39244
Buggy source:
/** 
 * provides the information for the visualization of the agents and places them on the grid
 */
private void drawAgents(){
  if (Parameters.parameters.booleanParameter("String_Node_Str")) {
    evaporate();
    colorScents();
  }
  TorusAgent[][] agents=game.getAgents();
  for (int i=0; i < agents.length; i++) {
    if (i == TorusPredPreyGame.AGENT_TYPE_PREY)     continue;
    for (int j=0; j < agents[i].length; j++) {
      if (agents[i][j] != null) {
        int row=(int)agents[i][j].getX();
        int x=x(row);
        int col=(int)agents[i][j].getY();
        int y=y(col);
        if (Parameters.parameters.booleanParameter("String_Node_Str")) {
          int m=((NNTorusPredPreyController)predControllers[j]).nn.lastModule();
          (i == TorusPredPreyGame.AGENT_TYPE_PRED ? predScents : preyScents)[j][m][row][col]=1.0f;
        }
        bufferGraphics.setColor(agents[i][j].getColor());
        bufferGraphics.fillRect(x + 1,(y - CELL_SIZE) + 1,CELL_SIZE - 1,CELL_SIZE - 1);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * provides the information for the visualization of the agents and places them on the grid
 */
private void drawAgents(){
  if (Parameters.parameters.booleanParameter("String_Node_Str")) {
    evaporate();
    colorScents();
  }
  TorusAgent[][] agents=game.getAgents();
  for (int i=0; i < agents.length; i++) {
    for (int j=0; j < agents[i].length; j++) {
      if (agents[i][j] != null) {
        int row=(int)agents[i][j].getX();
        int x=x(row);
        int col=(int)agents[i][j].getY();
        int y=y(col);
        if (Parameters.parameters.booleanParameter("String_Node_Str")) {
          TorusPredPreyController controller=(i == TorusPredPreyGame.AGENT_TYPE_PRED ? predControllers : preyControllers)[j];
          if (controller instanceof NNTorusPredPreyController) {
            int m=((NNTorusPredPreyController)controller).nn.lastModule();
            (i == TorusPredPreyGame.AGENT_TYPE_PRED ? predScents : preyScents)[j][m][row][col]=1.0f;
          }
 else {
            (i == TorusPredPreyGame.AGENT_TYPE_PRED ? predScents : preyScents)[j][0][row][col]=1.0f;
          }
        }
        bufferGraphics.setColor(agents[i][j].getColor());
        bufferGraphics.fillRect(x + 1,(y - CELL_SIZE) + 1,CELL_SIZE - 1,CELL_SIZE - 1);
      }
    }
  }
}
Program: 39246
Project: 39246
Buggy source:
private void evaporate(){
  for (int agent=0; agent < predScents.length; agent++) {
    for (int m=0; m < predScents[agent].length; m++) {
      for (int x=0; x < predScents[agent][m].length; x++) {
        for (int y=0; y < predScents[agent][m][x].length; y++) {
          predScents[agent][m][x][y]*=0.9;
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Weaken the scent presence of every cell, so that evidence of an agent occupying a given cell eventually disappears.
 */
private void evaporate(){
  for (int agent=0; agent < predScents.length; agent++) {
    for (int m=0; m < predScents[agent].length; m++) {
      for (int x=0; x < predScents[agent][m].length; x++) {
        for (int y=0; y < predScents[agent][m][x].length; y++) {
          predScents[agent][m][x][y]*=0.9;
        }
      }
    }
  }
}
Program: 39247
Project: 39247
Buggy source:
/** 
 * Calculates inputs for the neural network in order to figure what action to take in getAction.
 * @param me this agent
 * @param world torus grid world
 * @param preds predator agents
 * @param prey prey agents
 * @return inputs for the network
 */
public double[] inputs(TorusAgent me,TorusWorld world,TorusAgent[] preds,TorusAgent[] prey){
  double[] inputs=new double[numInputs];
  int startPosition=0;
  for (  TorusPredPreySensorBlock block : sensorBlocks) {
    System.arraycopy(block.sensorValues(me,world,preds,prey),0,inputs,startPosition,block.numSensors(isPredator));
    startPosition+=block.numSensors(isPredator);
  }
  return inputs;
}

Fixed version (ground truth):
/** 
 * Calculates inputs for the neural network in order to figure what action to take in getAction.
 * @param me this agent
 * @param world torus grid world
 * @param preds predator agents
 * @param prey prey agents
 * @return inputs for the network
 */
public double[] inputs(TorusAgent me,TorusWorld world,TorusAgent[] preds,TorusAgent[] prey){
  double[] inputs=new double[numInputs];
  int startPosition=0;
  for (  TorusPredPreySensorBlock block : sensorBlocks) {
    double[] sensors=block.sensorValues(me,world,preds,prey);
    int numSensors=block.numSensors(isPredator);
    System.arraycopy(sensors,0,inputs,startPosition,numSensors);
    startPosition+=numSensors;
  }
  return inputs;
}
Program: 39248
Project: 39248
Buggy source:
@Override public void addOutputSubstrates(List<Substrate> subs){
  Substrate dpad=new Substrate(new Pair<Integer,Integer>(3,2),Substrate.OUTPUT_SUBSTRATE,new Triple<Integer,Integer,Integer>(0,Substrate.OUTPUT_SUBSTRATE,0),"String_Node_Str");
  dpad.addDeadNeuron(0,0);
  dpad.addDeadNeuron(0,2);
  dpad.addDeadNeuron(1,1);
  subs.add(dpad);
}

Fixed version (ground truth):
@Override public void addOutputSubstrates(List<Substrate> subs){
  Substrate dpad=new Substrate(new Pair<Integer,Integer>(3,2),Substrate.OUTPUT_SUBSTRATE,new Triple<Integer,Integer,Integer>(0,Substrate.OUTPUT_SUBSTRATE,0),"String_Node_Str");
  dpad.addDeadNeuron(0,0);
  dpad.addDeadNeuron(2,0);
  dpad.addDeadNeuron(1,1);
  subs.add(dpad);
}
Program: 39249
Project: 39249
Buggy source:
@Override public void addOutputSubstrates(List<Substrate> subs){
  Substrate dpad=new Substrate(new Pair<Integer,Integer>(3,2),Substrate.OUTPUT_SUBSTRATE,new Triple<Integer,Integer,Integer>(0,Substrate.OUTPUT_SUBSTRATE,0),"String_Node_Str");
  dpad.addDeadNeuron(0,0);
  dpad.addDeadNeuron(0,2);
  dpad.addDeadNeuron(1,1);
  subs.add(dpad);
  Substrate cstick=new Substrate(new Pair<Integer,Integer>(2,1),Substrate.OUTPUT_SUBSTRATE,new Triple<Integer,Integer,Integer>(0,Substrate.OUTPUT_SUBSTRATE,0),"String_Node_Str");
  subs.add(cstick);
}

Fixed version (ground truth):
@Override public void addOutputSubstrates(List<Substrate> subs){
  Substrate dpad=new Substrate(new Pair<Integer,Integer>(3,2),Substrate.OUTPUT_SUBSTRATE,new Triple<Integer,Integer,Integer>(0,Substrate.OUTPUT_SUBSTRATE,0),"String_Node_Str");
  dpad.addDeadNeuron(0,0);
  dpad.addDeadNeuron(2,0);
  dpad.addDeadNeuron(1,1);
  subs.add(dpad);
  Substrate cstick=new Substrate(new Pair<Integer,Integer>(2,1),Substrate.OUTPUT_SUBSTRATE,new Triple<Integer,Integer,Integer>(0,Substrate.OUTPUT_SUBSTRATE,0),"String_Node_Str");
  subs.add(cstick);
}
Program: 39252
Project: 39252
Buggy source:
@Override public List<Pair<String,String>> getSubstrateConnectivity(){
  if (connections == null) {
    connections=new ArrayList<Pair<String,String>>();
    connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
    connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
    if (Parameters.parameters.booleanParameter("String_Node_Str")) {
      connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
      connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
    }
 else {
      connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
    }
    connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
    connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
    if (Parameters.parameters.booleanParameter("String_Node_Str")) {
      connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
      connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
      connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
      connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
    }
  }
  return connections;
}

Fixed version (ground truth):
@Override public List<Pair<String,String>> getSubstrateConnectivity(){
  if (connections == null) {
    connections=new ArrayList<Pair<String,String>>();
    connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
    connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
    if (Parameters.parameters.booleanParameter("String_Node_Str")) {
      connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
      connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
    }
 else {
      connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
    }
    connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
    connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
    if (Parameters.parameters.booleanParameter("String_Node_Str")) {
      connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
      connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
      if (Parameters.parameters.booleanParameter("String_Node_Str")) {
        connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
        connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
      }
 else {
        connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
      }
      connections.add(new Pair<String,String>("String_Node_Str","String_Node_Str"));
    }
  }
  return connections;
}
Program: 39254
Project: 39254
Buggy source:
@Override public List<Substrate> getSubstrateInformation(){
  if (subs == null) {
    subs=new ArrayList<Substrate>();
    Pair<Integer,Integer> subSize=new Pair<>(MS_PAC_MAN_SUBSTRATE_WIDTH,MS_PAC_MAN_SUBSTRATE_HEIGHT);
    Pair<Integer,Integer> processSize=new Pair<>(10,10);
    Substrate pillSubstrate=new Substrate(subSize,Substrate.INPUT_SUBSTRATE,new Triple<Integer,Integer,Integer>(0,0,0),"String_Node_Str");
    Substrate powerPillSubstrate=new Substrate(new Pair<Integer,Integer>(2,2),Substrate.INPUT_SUBSTRATE,new Triple<Integer,Integer,Integer>(1,0,0),"String_Node_Str");
    Substrate ghostSubstrate=new Substrate(subSize,Substrate.INPUT_SUBSTRATE,new Triple<Integer,Integer,Integer>(2,0,0),"String_Node_Str");
    Substrate pacManSubstrate=new Substrate(subSize,Substrate.INPUT_SUBSTRATE,new Triple<Integer,Integer,Integer>(3,0,0),"String_Node_Str");
    Substrate processSubstrate=new Substrate(processSize,Substrate.PROCCESS_SUBSTRATE,new Triple<Integer,Integer,Integer>(0,1,0),"String_Node_Str");
    Substrate outputSubstrate;
    if (Parameters.parameters.booleanParameter("String_Node_Str")) {
      outputSubstrate=new Substrate(subSize,Substrate.OUTPUT_SUBSTRATE,new Triple<Integer,Integer,Integer>(0,2,0),"String_Node_Str");
    }
 else {
      outputSubstrate=new Substrate(new Pair<Integer,Integer>(3,3),Substrate.OUTPUT_SUBSTRATE,new Triple<Integer,Integer,Integer>(0,2,0),"String_Node_Str");
      outputSubstrate.addDeadNeuron(0,0);
      outputSubstrate.addDeadNeuron(0,2);
      outputSubstrate.addDeadNeuron(1,1);
      outputSubstrate.addDeadNeuron(0,2);
      outputSubstrate.addDeadNeuron(2,2);
    }
    subs.add(pillSubstrate);
    subs.add(powerPillSubstrate);
    subs.add(ghostSubstrate);
    subs.add(pacManSubstrate);
    subs.add(processSubstrate);
    subs.add(outputSubstrate);
  }
  return subs;
}

Fixed version (ground truth):
@Override public List<Substrate> getSubstrateInformation(){
  if (subs == null) {
    subs=getSubstrateInformationFromScratch();
  }
  return subs;
}
Program: 39255
Project: 39255
Buggy source:
/** 
 * Figures out which neurons can be killed in the current maze.
 * @param gf game facade, which accesses current maze
 */
public void customizeSubstratesForMaze(GameFacade gf){
  getSubstrateInformation();
  for (  Substrate s : subs) {
    if (s.size.t1 == MS_PAC_MAN_SUBSTRATE_WIDTH && s.size.t2 == MS_PAC_MAN_SUBSTRATE_HEIGHT) {
      s.killAllNeurons();
      for (int i=0; i < gf.lengthMaze(); i++) {
        int x=gf.getNodeXCoord(i);
        int y=gf.getNodeYCoord(i);
        int scaledX=x / MsPacManTask.MS_PAC_MAN_NODE_DIM;
        int scaledY=y / MsPacManTask.MS_PAC_MAN_NODE_DIM;
        s.resurrectNeuron(scaledX,scaledY);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Figures out which neurons can be killed in the current maze.
 * @param gf game facade, which accesses current maze
 */
public void customizeSubstratesForMaze(GameFacade gf){
  substratesForMaze=new HashMap<Integer,List<Substrate>>();
  for (int j=0; j < Constants.NUM_MAZES; j++) {
    List<Substrate> localSubs=getSubstrateInformationFromScratch();
    for (    Substrate s : localSubs) {
      if (s.size.t1 == MS_PAC_MAN_SUBSTRATE_WIDTH && s.size.t2 == MS_PAC_MAN_SUBSTRATE_HEIGHT) {
        s.killAllNeurons();
        for (int i=0; i < gf.lengthMaze(); i++) {
          int x=gf.getNodeXCoord(i);
          int y=gf.getNodeYCoord(i);
          int scaledX=x / MsPacManTask.MS_PAC_MAN_NODE_DIM;
          int scaledY=y / MsPacManTask.MS_PAC_MAN_NODE_DIM;
          s.resurrectNeuron(scaledX,scaledY);
        }
      }
      substratesForMaze.put(j,localSubs);
    }
  }
}
Program: 39256
Project: 39256
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public int getDirection(GameFacade gf){
  if (gf.getMazeIndex() != currentMaze) {
    currentMaze=gf.getMazeIndex();
    nn=networkForMaze.get(currentMaze);
    if (CommonConstants.monitorSubstrates) {
      ((MsPacManTask)MMNEAT.task).customizeSubstratesForMaze(gf);
    }
  }
  double[] inputs=inputMediator.getInputs(gf,gf.getPacmanLastMoveMade());
  double[] outputs=nn.process(inputs);
  if (pacManFullScreenOutput) {
    int chosenNode=-1;
    double nodePreference=Double.NEGATIVE_INFINITY;
    for (int i=0; i < gf.lengthMaze(); i++) {
      int x=gf.getNodeXCoord(i);
      int y=gf.getNodeYCoord(i);
      int j=getOutputIndexFromNodeCoord(x,y);
      if (outputs[j] > nodePreference) {
        nodePreference=outputs[j];
        chosenNode=i;
      }
    }
    return gf.getNextPacManDirTowardsTarget(chosenNode);
  }
 else {
    double[] realOutputs=new double[4];
    realOutputs[GameFacade.moveToIndex(MOVE.UP)]=outputs[UP];
    realOutputs[GameFacade.moveToIndex(MOVE.LEFT)]=outputs[LEFT];
    realOutputs[GameFacade.moveToIndex(MOVE.RIGHT)]=outputs[RIGHT];
    realOutputs[GameFacade.moveToIndex(MOVE.DOWN)]=outputs[DOWN];
    return StatisticsUtilities.argmax(realOutputs);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public int getDirection(GameFacade gf){
  if (gf.getMazeIndex() != currentMaze) {
    currentMaze=gf.getMazeIndex();
    nn=networkForMaze.get(currentMaze);
    if (CommonConstants.monitorSubstrates) {
      ((MsPacManTask)MMNEAT.task).substratesForMaze.get(currentMaze);
    }
  }
  double[] inputs=inputMediator.getInputs(gf,gf.getPacmanLastMoveMade());
  double[] outputs=nn.process(inputs);
  if (pacManFullScreenOutput) {
    int chosenNode=-1;
    double nodePreference=Double.NEGATIVE_INFINITY;
    for (int i=0; i < gf.lengthMaze(); i++) {
      int x=gf.getNodeXCoord(i);
      int y=gf.getNodeYCoord(i);
      int j=getOutputIndexFromNodeCoord(x,y);
      if (outputs[j] > nodePreference) {
        nodePreference=outputs[j];
        chosenNode=i;
      }
    }
    return gf.getNextPacManDirTowardsTarget(chosenNode);
  }
 else {
    double[] realOutputs=new double[4];
    realOutputs[GameFacade.moveToIndex(MOVE.UP)]=outputs[UP];
    realOutputs[GameFacade.moveToIndex(MOVE.LEFT)]=outputs[LEFT];
    realOutputs[GameFacade.moveToIndex(MOVE.RIGHT)]=outputs[RIGHT];
    realOutputs[GameFacade.moveToIndex(MOVE.DOWN)]=outputs[DOWN];
    return StatisticsUtilities.argmax(realOutputs);
  }
}
Program: 39257
Project: 39257
Buggy source:
/** 
 * As above, but it is now possible to indicate how the score is statistically summarized when noisy evaluations occur. The default is to average scores across evaluations, but if an overriding statistic is used, then this will also be mentioned in the log.
 * @param name Name of score column
 * @param override Statistic applied across evaluations (null is default/average)
 * @param affectsSelection whether it affects selection
 * @param pop population index (for coevolution)
 */
public static void registerFitnessFunction(String name,Statistic override,boolean affectsSelection,int pop){
  if (affectsSelection) {
    actualFitnessFunctions++;
  }
  while (fitnessFunctions.size() <= pop) {
    fitnessFunctions.add(new ArrayList<String>());
  }
  fitnessFunctions.get(pop).add(name);
  aggregationOverrides.add(override);
}

Fixed version (ground truth):
/** 
 * As above, but it is now possible to indicate how the score is statistically summarized when noisy evaluations occur. The default is to average scores across evaluations, but if an overriding statistic is used, then this will also be mentioned in the log.
 * @param name Name of score column
 * @param override Statistic applied across evaluations (null is default/average)
 * @param affectsSelection whether it affects selection
 * @param pop population index (for coevolution)
 */
public static void registerFitnessFunction(String name,Statistic override,boolean affectsSelection,int pop){
  if (actualFitnessFunctions == null) {
    actualFitnessFunctions=new ArrayList<Integer>();
  }
  while (actualFitnessFunctions.size() <= pop) {
    actualFitnessFunctions.add(0);
  }
  if (affectsSelection) {
    int num=actualFitnessFunctions.get(pop) + 1;
    actualFitnessFunctions.set(pop,num);
  }
  while (fitnessFunctions.size() <= pop) {
    fitnessFunctions.add(new ArrayList<String>());
  }
  fitnessFunctions.get(pop).add(name);
  aggregationOverrides.add(override);
}
Program: 39258
Project: 39258
Buggy source:
@SuppressWarnings("String_Node_Str") public static ArrayList<String> fitnessPlusMetaheuristics(int pop){
  @SuppressWarnings("String_Node_Str") ArrayList<String> result=(ArrayList<String>)fitnessFunctions.get(pop).clone();
  if (pop == 0) {
    ArrayList<String> meta=new ArrayList<String>();
    for (    Metaheuristic m : metaheuristics) {
      meta.add(m.getClass().getSimpleName());
    }
    result.addAll(actualFitnessFunctions,meta);
  }
  return result;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static ArrayList<String> fitnessPlusMetaheuristics(int pop){
  @SuppressWarnings("String_Node_Str") ArrayList<String> result=(ArrayList<String>)fitnessFunctions.get(pop).clone();
  if (pop == 0) {
    ArrayList<String> meta=new ArrayList<String>();
    for (    Metaheuristic m : metaheuristics) {
      meta.add(m.getClass().getSimpleName());
    }
    result.addAll(actualFitnessFunctions.get(pop),meta);
  }
  return result;
}
Program: 39260
Project: 39260
Buggy source:
/** 
 * An array containing a 1 if a block is present, and a 0 otherwise.
 * @param o
 * @return inputs
 */
@Override public double[] extract(Observation o){
  boolean negative=Parameters.parameters.booleanParameter("String_Node_Str");
  boolean senseHoles=Parameters.parameters.booleanParameter("String_Node_Str");
  if (negative && senseHoles) {
    System.out.println("String_Node_Str");
    System.exit(1);
  }
  int[] worldState=new int[TetrisState.worldWidth * TetrisState.worldHeight];
  System.arraycopy(o.intArray,0,worldState,0,TetrisState.worldWidth * TetrisState.worldHeight);
  double[] result=new double[worldState.length];
  System.out.println("String_Node_Str" + Arrays.toString(worldState));
  for (int i=0; i < result.length; i++) {
    if (Math.signum(worldState[i]) == 0) {
      int temp=negative ? -1 : 0;
      result[i]=temp;
    }
 else     if (worldState[i] > 0) {
      result[i]=Math.signum(worldState[i]);
    }
 else     if (senseHoles && TetrisExtractorUtil.isHole(i,worldState)) {
      result[i]=-1;
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * An array containing a 1 if a block is present, and a 0 otherwise.
 * @param o
 * @return inputs
 */
@Override public double[] extract(Observation o){
  boolean negative=Parameters.parameters.booleanParameter("String_Node_Str");
  boolean senseHoles=Parameters.parameters.booleanParameter("String_Node_Str");
  if (negative && senseHoles) {
    System.out.println("String_Node_Str");
    System.exit(1);
  }
  int[] worldState=new int[TetrisState.worldWidth * TetrisState.worldHeight];
  System.arraycopy(o.intArray,0,worldState,0,TetrisState.worldWidth * TetrisState.worldHeight);
  double[] result=new double[worldState.length];
  for (int i=0; i < result.length; i++) {
    if (Math.signum(worldState[i]) == 0) {
      int temp=negative ? -1 : 0;
      result[i]=temp;
    }
 else     if (worldState[i] > 0) {
      result[i]=Math.signum(worldState[i]);
    }
 else     if (senseHoles && TetrisExtractorUtil.isHole(i,worldState)) {
      result[i]=-1;
    }
  }
  return result;
}
Program: 39261
Project: 39261
Buggy source:
public static boolean isHole(int index,int[] worldState){
  int x=getColumn(index);
  return false;
}

Fixed version (ground truth):
public static boolean isHole(int index,int[] worldState){
  int x=getColumn(index);
  boolean isBlockAbove=false;
  while (x < index) {
    if (worldState[x] == 1) {
      isBlockAbove=true;
    }
    x+=TetrisState.worldWidth;
  }
  if (worldState[index] == 1 && isBlockAbove) {
    return true;
  }
  return false;
}
Program: 39262
Project: 39262
Buggy source:
/** 
 * Calculate the linear array position from (x,y) components based on worldWidth. 
 * @param x x-coord
 * @param y y-coord
 * @return location in array
 */
public static int calculateLinearArrayPosition(int x,int y,int worldWidth){
  int returnValue=y * worldWidth + x;
  System.out.println("String_Node_Str" + returnValue);
  return returnValue;
}

Fixed version (ground truth):
/** 
 * Calculate the linear array position from (x,y) components based on worldWidth. 
 * @param x x-coord
 * @param y y-coord
 * @return location in array
 */
public static int calculateLinearArrayPosition(int x,int y,int worldWidth){
  int returnValue=y * worldWidth + x;
  return returnValue;
}
Program: 39263
Project: 39263
Buggy source:
/** 
 * Uses another CPPN to create a TWEANN controller for the domain. This created TWEANN is unique only to the instance in which it is used. In a sense, it's a one-and-done network, which explains the lax use of innovation numbers
 * @return TWEANN generated by CPPN
 */
@Override public TWEANN getPhenotype(){
  constructingNetwork=true;
  TWEANN cppn=getCPPN();
  System.out.println("String_Node_Str" + cppn.numOutputs());
  HyperNEATTask hnt=(HyperNEATTask)MMNEAT.task;
  List<Substrate> subs=hnt.getSubstrateInformation();
  List<Pair<String,String>> connections=hnt.getSubstrateConnectivity();
  ArrayList<NodeGene> newNodes=null;
  ArrayList<LinkGene> newLinks=null;
  innovationID=0;
  int phenotypeOutputs=0;
  newNodes=createSubstrateNodes(subs);
  HashMap<String,Integer> substrateIndexMapping=new HashMap<String,Integer>();
  for (int i=0; i < subs.size(); i++) {
    substrateIndexMapping.put(subs.get(i).getName(),i);
  }
  newLinks=createNodeLinks(cppn,connections,subs,substrateIndexMapping);
  for (  Substrate s : subs) {
    if (s.getStype() == Substrate.OUTPUT_SUBSTRATE) {
      phenotypeOutputs+=s.size.t1 * s.size.t2;
    }
  }
  TWEANNGenotype tg=new TWEANNGenotype(newNodes,newLinks,phenotypeOutputs,false,false,-1);
  constructingNetwork=false;
  return tg.getPhenotype();
}

Fixed version (ground truth):
/** 
 * Uses another CPPN to create a TWEANN controller for the domain. This created TWEANN is unique only to the instance in which it is used. In a sense, it's a one-and-done network, which explains the lax use of innovation numbers
 * @return TWEANN generated by CPPN
 */
@Override public TWEANN getPhenotype(){
  constructingNetwork=true;
  TWEANN cppn=getCPPN();
  HyperNEATTask hnt=(HyperNEATTask)MMNEAT.task;
  List<Substrate> subs=hnt.getSubstrateInformation();
  List<Pair<String,String>> connections=hnt.getSubstrateConnectivity();
  ArrayList<NodeGene> newNodes=null;
  ArrayList<LinkGene> newLinks=null;
  innovationID=0;
  int phenotypeOutputs=0;
  newNodes=createSubstrateNodes(subs);
  HashMap<String,Integer> substrateIndexMapping=new HashMap<String,Integer>();
  for (int i=0; i < subs.size(); i++) {
    substrateIndexMapping.put(subs.get(i).getName(),i);
  }
  newLinks=createNodeLinks(cppn,connections,subs,substrateIndexMapping);
  for (  Substrate s : subs) {
    if (s.getStype() == Substrate.OUTPUT_SUBSTRATE) {
      phenotypeOutputs+=s.size.t1 * s.size.t2;
    }
  }
  TWEANNGenotype tg=new TWEANNGenotype(newNodes,newLinks,phenotypeOutputs,false,false,-1);
  constructingNetwork=false;
  return tg.getPhenotype();
}
Program: 39265
Project: 39265
Buggy source:
/** 
 * creates an array list containing all the nodes from all the substrates
 * @param subs list of substrates extracted from domain
 * @return array list of NodeGenes from substrates
 */
public ArrayList<NodeGene> createSubstrateNodes(List<Substrate> subs){
  ArrayList<NodeGene> newNodes=new ArrayList<NodeGene>();
  for (int i=0; i < subs.size(); i++) {
    for (int x=0; x < subs.get(i).size.t1; x++) {
      for (int y=0; y < subs.get(i).size.t2; y++) {
        newNodes.add(new NodeGene(CommonConstants.ftype,subs.get(i).getStype(),innovationID++));
      }
    }
  }
  return newNodes;
}

Fixed version (ground truth):
/** 
 * creates an array list containing all the nodes from all the substrates
 * @param subs list of substrates extracted from domain
 * @return array list of NodeGenes from substrates
 */
public ArrayList<NodeGene> createSubstrateNodes(List<Substrate> subs){
  ArrayList<NodeGene> newNodes=new ArrayList<NodeGene>();
  for (int i=0; i < subs.size(); i++) {
    for (int y=0; y < subs.get(i).size.t2; y++) {
      for (int x=0; x < subs.get(i).size.t1; x++) {
        newNodes.add(new NodeGene(CommonConstants.ftype,subs.get(i).getStype(),innovationID++));
      }
    }
  }
  return newNodes;
}
Program: 39266
Project: 39266
Buggy source:
/** 
 * Activate all neurons in layer with specified activation function
 * @param nodes 2D array of pre-activated neuron sums
 * @param ftype Valid activation function type in ActivationFunctions
 */
public static void activateLayer(double[][] nodes,int ftype){
  for (int i=0; i < nodes.length; i++) {
    for (int j=0; j < nodes[0].length; j++) {
      if (i == 0 && j == 0)       System.out.println("String_Node_Str" + nodes[i][j]);
      nodes[i][j]=ActivationFunctions.activation(ftype,nodes[i][j]);
      if (i == 0 && j == 0)       System.out.println("String_Node_Str" + nodes[i][j]);
    }
  }
}

Fixed version (ground truth):
/** 
 * Activate all neurons in layer with specified activation function
 * @param nodes 2D array of pre-activated neuron sums
 * @param ftype Valid activation function type in ActivationFunctions
 */
public static void activateLayer(double[][] nodes,int ftype){
  for (int i=0; i < nodes.length; i++) {
    for (int j=0; j < nodes[0].length; j++) {
      nodes[i][j]=ActivationFunctions.activation(ftype,nodes[i][j]);
    }
  }
}
Program: 39267
Project: 39267
Buggy source:
@Override public String toString(){
  System.out.println("String_Node_Str" + connections.size());
  String result="String_Node_Str";
  result+=numInputs + "String_Node_Str";
  result+=numOutputs + "String_Node_Str";
  result+=ActivationFunctions.activationName(ftype) + "String_Node_Str";
  for (  MLPConnection connection : connections) {
    for (int X1=0; X1 < connection.connection.length; X1++) {
      for (int Y1=0; Y1 < connection.connection[0].length; Y1++) {
        for (int X2=0; X2 < connection.connection[0][0].length; X2++) {
          for (int Y2=0; Y2 < connection.connection[0][0][0].length; Y2++) {
            result+=connection.connects.t1 + "String_Node_Str" + X1+ "String_Node_Str"+ Y1+ "String_Node_Str"+ "String_Node_Str"+ connection.connection[X1][Y1][X2][Y2]+ "String_Node_Str"+ connection.connects.t2+ "String_Node_Str"+ X2+ "String_Node_Str"+ Y2+ "String_Node_Str"+ "String_Node_Str";
          }
        }
      }
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public String toString(){
  String result="String_Node_Str";
  result+=numInputs + "String_Node_Str";
  result+=numOutputs + "String_Node_Str";
  result+=ActivationFunctions.activationName(ftype) + "String_Node_Str";
  for (  MLPConnection connection : connections) {
    for (int X1=0; X1 < connection.connection.length; X1++) {
      for (int Y1=0; Y1 < connection.connection[0].length; Y1++) {
        for (int X2=0; X2 < connection.connection[0][0].length; X2++) {
          for (int Y2=0; Y2 < connection.connection[0][0][0].length; Y2++) {
            result+=connection.connects.t1 + "String_Node_Str" + X1+ "String_Node_Str"+ Y1+ "String_Node_Str"+ "String_Node_Str"+ connection.connection[X1][Y1][X2][Y2]+ "String_Node_Str"+ connection.connects.t2+ "String_Node_Str"+ X2+ "String_Node_Str"+ Y2+ "String_Node_Str"+ "String_Node_Str";
          }
        }
      }
    }
  }
  return result;
}
Program: 39268
Project: 39268
Buggy source:
@Test public void testProcess(){
  double[] inputs=new double[25];
  for (double i=0; i < inputs.length; i++) {
    inputs[(int)i]=(1 + i) / inputs.length;
  }
  System.out.println("String_Node_Str" + Arrays.toString(inputs));
  mlp.flush();
  double[] outputs=mlp.process(inputs);
  System.out.println(mlp);
  System.out.println("String_Node_Str" + Arrays.toString(outputs));
  assertEquals(outputs.length,4);
  TWEANN tweann=hcppn.getPhenotype();
  System.out.println(tweann);
  double[] tweannOut=tweann.process(inputs);
  System.out.println("String_Node_Str" + Arrays.toString(tweannOut));
  MiscUtil.waitForReadStringAndEnterKeyPress();
  assertEquals(outputs.length,tweannOut.length);
  for (int i=0; i < outputs.length; i++) {
    assertEquals(outputs[i],tweannOut[i],.0001);
  }
}

Fixed version (ground truth):
@Test public void testProcess(){
  double[] inputs=new double[9];
  for (double i=0; i < inputs.length; i++) {
    inputs[(int)i]=(1 + i) / inputs.length;
  }
  System.out.println("String_Node_Str" + Arrays.toString(inputs));
  mlp.flush();
  double[] outputs=mlp.process(inputs);
  System.out.println(mlp);
  System.out.println("String_Node_Str" + Arrays.toString(outputs));
  assertEquals(outputs.length,4);
  TWEANN tweann=hcppn.getPhenotype();
  System.out.println(tweann);
  double[] tweannOut=tweann.process(inputs);
  System.out.println("String_Node_Str" + Arrays.toString(tweannOut));
  assertEquals(outputs.length,tweannOut.length);
  for (int i=0; i < outputs.length; i++) {
    assertEquals(outputs[i],tweannOut[i],.0001);
  }
}
Program: 39269
Project: 39269
Buggy source:
@Test public void doubleArrayFrom2DdoubleArray_test(){
  double[][] inputs={{1,2,3},{4,5,6},{7,8,9}};
  double[] outputs={1,2,3,4,5,6,7,8,9};
  assertTrue(Arrays.equals(outputs,ArrayUtil.doubleArrayFrom2DdoubleArray(inputs)));
}

Fixed version (ground truth):
@Test public void doubleArrayFrom2DdoubleArray_test(){
  double[][] inputs={{1,2,3},{4,5,6},{7,8,9}};
  double[] outputs={1,2,3,4,5,6,7,8,9};
  assertTrue(Arrays.equals(outputs,ArrayUtil.doubleArrayFrom2DdoubleArrayColMajor(inputs)));
}
Program: 39270
Project: 39270
Buggy source:
@Override public double fitness(Organism<T> individual){
  TorusAgent[] prey=game.getPrey();
  double score=0;
  for (int i=0; i < prey.length; i++) {
    if (prey[i] != null) {
      score-=StatisticsUtilities.sum(prey[i].distances(prey));
    }
  }
  return score;
}

Fixed version (ground truth):
@Override public double fitness(Organism<T> individual){
  TorusAgent[] prey=game.getPrey();
  TorusAgent[] filteredPrey=ArrayUtil.filterNull(prey);
  double score=0;
  for (int i=0; i < filteredPrey.length; i++) {
    score-=StatisticsUtilities.sum(filteredPrey[i].distances(filteredPrey));
  }
  return score;
}
Program: 39272
Project: 39272
Buggy source:
@Override public TorusPredPreyTask<T> getLonerTaskInstance(){
  if (task == null) {
    task=new TorusEvolvedPredatorsVsStaticPreyTask<T>();
    while (task.objectives.size() < numberOfPopulations()) {
      task.addAllObjectives(task.objectives.size());
    }
  }
  return task;
}

Fixed version (ground truth):
@Override public TorusPredPreyTask<T> getLonerTaskInstance(){
  if (task == null) {
    task=new TorusEvolvedPredatorsVsStaticPreyTask<T>();
    while (task.objectives.size() < Parameters.parameters.integerParameter("String_Node_Str")) {
      task.addAllObjectives(task.objectives.size());
    }
  }
  return task;
}
Program: 39273
Project: 39273
Buggy source:
@Override public TorusPredPreyTask<T> getLonerTaskInstance(){
  if (task == null) {
    task=new TorusEvolvedPreyVsStaticPredatorsTask<T>();
    while (task.objectives.size() < numberOfPopulations()) {
      task.addAllObjectives(task.objectives.size());
    }
  }
  return task;
}

Fixed version (ground truth):
@Override public TorusPredPreyTask<T> getLonerTaskInstance(){
  if (task == null) {
    task=new TorusEvolvedPreyVsStaticPredatorsTask<T>();
    while (task.objectives.size() < Parameters.parameters.integerParameter("String_Node_Str")) {
      task.addAllObjectives(task.objectives.size());
    }
  }
  return task;
}
Program: 39275
Project: 39275
Buggy source:
/** 
 * Does not make sense for the same reason. Each population has several min scores. This is why it cannot be overridden again.
 */
@Override public final double[] minScores(){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Does not make sense for the same reason. Each population has several min scores. This is why it cannot be overridden again.
 */
@Override public double[] minScores(){
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 39276
Project: 39276
Buggy source:
@Override public ArrayList<Score> evaluate(Genotype[] team){
  ArrayList<Score> scores=new ArrayList<Score>();
  TorusPredPreyController[] predAgents=getPredAgents(team);
  TorusPredPreyController[] preyAgents=getPreyAgents(team);
  TorusPredPreyGame game=getLonerTaskInstance().runEval(predAgents,preyAgents);
  for (int i=0; i < numberOfPopulations(); i++) {
    double[] fitnesses=new double[objectivesPerPopulation()[i]];
    double[] otherStats=new double[otherStatsPerPopulation()[i]];
    Organism<T> organism=new NNTorusPredPreyAgent<T>(team[i],!task.preyEvolve);
    for (int j=0; j < fitnesses.length; j++) {
      fitnesses[j]=task.objectives.get(i).get(j).score(game,organism);
    }
    for (int j=0; j < otherStats.length; j++) {
      otherStats[j]=task.otherScores.get(i).get(j).score(game,organism);
    }
    scores.add(new Score(team[i],fitnesses,null,otherStats));
  }
  return scores;
}

Fixed version (ground truth):
@Override public ArrayList<Score> evaluate(Genotype[] team){
  ArrayList<Score> scores=new ArrayList<Score>();
  TorusPredPreyController[] predAgents=getPredAgents(team);
  TorusPredPreyController[] preyAgents=getPreyAgents(team);
  TorusPredPreyGame game=getLonerTaskInstance().runEval(predAgents,preyAgents);
  for (int i=0; i < numberOfPopulations(); i++) {
    double[] fitnesses=new double[objectivesPerPopulation()[i]];
    double[] otherStats=new double[otherStatsPerPopulation()[i]];
    Organism<T> organism=new NNTorusPredPreyAgent<T>(team[i],!task.preyEvolve);
    for (int j=0; j < fitnesses.length; j++) {
      fitnesses[j]=task.objectives.get(0).get(j).score(game,organism);
    }
    for (int j=0; j < otherStats.length; j++) {
      otherStats[j]=task.otherScores.get(0).get(j).score(game,organism);
    }
    scores.add(new Score(team[i],fitnesses,null,otherStats));
  }
  return scores;
}
Program: 39277
Project: 39277
Buggy source:
@Override public TorusPredPreyTask<T> getLonerTaskInstance(){
  if (task == null) {
    task=new TorusEvolvedPredatorsVsStaticPreyTask<T>();
  }
  return task;
}

Fixed version (ground truth):
@Override public TorusPredPreyTask<T> getLonerTaskInstance(){
  if (task == null) {
    task=new TorusEvolvedPredatorsVsStaticPreyTask<T>();
    while (task.objectives.size() < numberOfPopulations()) {
      task.addAllObjectives(task.objectives.size());
    }
  }
  return task;
}
Program: 39278
Project: 39278
Buggy source:
@Override public int[] otherStatsPerPopulation(){
  int scores=task.numOtherScores();
  int[] result=new int[Parameters.parameters.integerParameter("String_Node_Str")];
  for (int i=0; i < result.length; i++) {
    result[i]=scores;
  }
  return result;
}

Fixed version (ground truth):
@Override public int[] otherStatsPerPopulation(){
  int scores=task.numOtherScores();
  int[] result=new int[Parameters.parameters.integerParameter("String_Node_Str")];
  result[0]=scores;
  return result;
}
Program: 39279
Project: 39279
Buggy source:
@Override public TorusPredPreyTask<T> getLonerTaskInstance(){
  if (task == null) {
    task=new TorusEvolvedPreyVsStaticPredatorsTask<T>();
  }
  return task;
}

Fixed version (ground truth):
@Override public TorusPredPreyTask<T> getLonerTaskInstance(){
  if (task == null) {
    task=new TorusEvolvedPreyVsStaticPredatorsTask<T>();
    while (task.objectives.size() < numberOfPopulations()) {
      task.addAllObjectives(task.objectives.size());
    }
  }
  return task;
}
Program: 39280
Project: 39280
Buggy source:
@Override public int[] otherStatsPerPopulation(){
  int scores=task.numOtherScores();
  int[] result=new int[Parameters.parameters.integerParameter("String_Node_Str")];
  for (int i=0; i < result.length; i++) {
    result[i]=scores;
  }
  return result;
}

Fixed version (ground truth):
@Override public int[] otherStatsPerPopulation(){
  int scores=task.numOtherScores();
  int[] result=new int[Parameters.parameters.integerParameter("String_Node_Str")];
  result[0]=scores;
  return result;
}
Program: 39281
Project: 39281
Buggy source:
@Override public ArrayList<Score> evaluate(Genotype[] team){
  ArrayList<Score> scores=new ArrayList<Score>();
  TorusPredPreyController[] predAgents=getPredAgents(team);
  TorusPredPreyController[] preyAgents=getPreyAgents(team);
  TorusPredPreyGame game=getLonerTaskInstance().runEval(predAgents,preyAgents);
  for (int i=0; i < numberOfPopulations(); i++) {
    double[] fitnesses=new double[objectivesPerPopulation()[i]];
    double[] otherStats=new double[otherStatsPerPopulation()[i]];
    Organism<T> organism=new NNTorusPredPreyAgent<T>(team[i],!task.preyEvolve);
    for (int j=0; j < fitnesses.length; j++) {
      fitnesses[j]=task.objectives.get(0).get(j).score(game,organism);
    }
    for (int j=0; j < otherStats.length; j++) {
      otherStats[j]=task.otherScores.get(0).get(j).score(game,organism);
    }
    scores.add(new Score(team[i],fitnesses,null,otherStats));
  }
  return scores;
}

Fixed version (ground truth):
@Override public ArrayList<Score> evaluate(Genotype[] team){
  ArrayList<Score> scores=new ArrayList<Score>();
  TorusPredPreyController[] predAgents=getPredAgents(team);
  TorusPredPreyController[] preyAgents=getPreyAgents(team);
  TorusPredPreyGame game=getLonerTaskInstance().runEval(predAgents,preyAgents);
  for (int i=0; i < numberOfPopulations(); i++) {
    double[] fitnesses=new double[objectivesPerPopulation()[i]];
    double[] otherStats=new double[otherStatsPerPopulation()[i]];
    Organism<T> organism=new NNTorusPredPreyAgent<T>(team[i],!task.preyEvolve);
    for (int j=0; j < fitnesses.length; j++) {
      fitnesses[j]=task.objectives.get(i).get(j).score(game,organism);
    }
    for (int j=0; j < otherStats.length; j++) {
      otherStats[j]=task.otherScores.get(i).get(j).score(game,organism);
    }
    scores.add(new Score(team[i],fitnesses,null,otherStats));
  }
  return scores;
}
Program: 39283
Project: 39283
Buggy source:
/** 
 * gets and returns the sensor labels for this task
 * @return sensor labels in an array of strings
 */
@Override public String[] sensorLabels(){
  return task.sensorLabels();
}

Fixed version (ground truth):
/** 
 * gets and returns the sensor labels for this task
 * @return sensor labels in an array of strings
 */
@Override public String[] sensorLabels(){
  return task.preyEvolve ? (new NNTorusPredPreyController(null,false)).sensorLabels() : (new NNTorusPredPreyController(null,true)).sensorLabels();
}
Program: 39284
Project: 39284
Buggy source:
/** 
 * An array containing a 1 if a block is present, and a 0 otherwise.
 * @param o
 * @return 
 */
@Override public double[] extract(Observation o){
  TetrisState state=TetrisAfterStateAgent.observationToTetrisState(o);
  double[] result=new double[state.worldState.length];
  for (int i=0; i < result.length; i++) {
    result[i]=Math.signum(state.worldState[i]);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * An array containing a 1 if a block is present, and a 0 otherwise.
 * @param o
 * @return 
 */
@Override public double[] extract(Observation o){
  System.out.print("String_Node_Str");
  System.out.println(Parameters.parameters.booleanParameter("String_Node_Str"));
  TetrisState state=TetrisAfterStateAgent.observationToTetrisState(o);
  double[] result=new double[state.worldState.length];
  for (int i=0; i < result.length; i++) {
    result[i]=Math.signum(state.worldState[i]);
  }
  return result;
}
Program: 39287
Project: 39287
Buggy source:
@Override public TorusPredPreyController[] getPredAgents(Genotype<T>[] team){
  TorusPredPreyController[] evolved=getLonerTaskInstance().evolved;
  TorusPredPreyTask.getEvolvedControllers(evolved,team,true);
  return evolved;
}

Fixed version (ground truth):
@Override public TorusPredPreyController[] getPredAgents(Genotype<T>[] team){
  TorusPredPreyController[] evolved=new TorusPredPreyController[Parameters.parameters.integerParameter("String_Node_Str")];
  TorusPredPreyTask.getEvolvedControllers(evolved,team,true);
  return evolved;
}
Program: 39288
Project: 39288
Buggy source:
@Override public TorusPredPreyController[] getPreyAgents(Genotype<T>[] team){
  TorusPredPreyController[] evolved=getLonerTaskInstance().evolved;
  TorusPredPreyTask.getEvolvedControllers(evolved,team,false);
  return evolved;
}

Fixed version (ground truth):
@Override public TorusPredPreyController[] getPreyAgents(Genotype<T>[] team){
  TorusPredPreyController[] evolved=new TorusPredPreyController[Parameters.parameters.integerParameter("String_Node_Str")];
  TorusPredPreyTask.getEvolvedControllers(evolved,team,false);
  return evolved;
}