nus-yam/ex-repair huggingface dataset:
Program: 39202
Project: 39202
Buggy source:
/** 
 * Calculates fitness for episode result based on blocks on screen and number of steps, and  saves this value and number of rows on screen into a pair of arrays
 * @param num index of return value in RL array
 * @return pair of arrays containing fitness and number of rows on screen
 */
@Override public Pair<double[],double[]> episodeResult(int num){
  double[] fitness=new double[numObjectives()];
  int index=0;
  if (tetrisTimeSteps)   fitness[index++]=rlNumSteps[num];
  if (tetrisBlocksOnScreen) {
    @SuppressWarnings("String_Node_Str") TetrisAfterStateAgent<T> tasa=(TetrisAfterStateAgent<T>)agent;
    int numberOfBlocksInState;
    if (rlNumSteps[num] == maxStepsPerEpisode) {
      numberOfBlocksInState=TetrisState.worldHeight * TetrisState.worldWidth;
    }
 else {
      numberOfBlocksInState=tasa.getNumberOfBlocksInLastState();
    }
    fitness[index++]=numberOfBlocksInState;
  }
  Tetris game=(Tetris)environment;
  if (tetrisAvgEmptySpaces)   fitness[index++]=game.getAverageNumEmptySpaces();
  if (tetrisLinesNotScore) {
    fitness[index++]=game.getLinesCleared();
  }
 else {
    fitness[index++]=rlReturn[num];
  }
  double[] rowCounts=game.getNumberOfRowsCleared();
  double[] otherScores=new double[numOtherScores()];
  otherScores[0]=rowCounts[0];
  otherScores[1]=rowCounts[1];
  otherScores[2]=rowCounts[2];
  otherScores[3]=rowCounts[3];
  otherScores[4]=game.getLinesCleared();
  otherScores[3]=rlReturn[num];
  Pair<double[],double[]> p=new Pair<double[],double[]>(fitness,otherScores);
  return p;
}

Fixed version (ground truth):
/** 
 * Calculates fitness for episode result based on blocks on screen and number of steps, and  saves this value and number of rows on screen into a pair of arrays
 * @param num index of return value in RL array
 * @return pair of arrays containing fitness and number of rows on screen
 */
@Override public Pair<double[],double[]> episodeResult(int num){
  double[] fitness=new double[numObjectives()];
  int index=0;
  if (tetrisTimeSteps)   fitness[index++]=rlNumSteps[num];
  if (tetrisBlocksOnScreen) {
    @SuppressWarnings("String_Node_Str") TetrisAfterStateAgent<T> tasa=(TetrisAfterStateAgent<T>)agent;
    int numberOfBlocksInState;
    if (rlNumSteps[num] == maxStepsPerEpisode) {
      numberOfBlocksInState=TetrisState.worldHeight * TetrisState.worldWidth;
    }
 else {
      numberOfBlocksInState=tasa.getNumberOfBlocksInLastState();
    }
    fitness[index++]=numberOfBlocksInState;
  }
  Tetris game=(Tetris)environment;
  if (tetrisAvgEmptySpaces)   fitness[index++]=game.getAverageNumEmptySpaces();
  if (tetrisLinesNotScore) {
    fitness[index++]=game.getLinesCleared();
  }
 else {
    fitness[index++]=rlReturn[num];
  }
  double[] rowCounts=game.getNumberOfRowsCleared();
  double[] otherScores=new double[numOtherScores()];
  otherScores[0]=rowCounts[0];
  otherScores[1]=rowCounts[1];
  otherScores[2]=rowCounts[2];
  otherScores[3]=rowCounts[3];
  otherScores[4]=game.getLinesCleared();
  otherScores[5]=rlReturn[num];
  Pair<double[],double[]> p=new Pair<double[],double[]>(fitness,otherScores);
  return p;
}
Program: 39203
Project: 39203
Buggy source:
/** 
 * Method returns a taskspec that reflects the current game state
 * @return provides task details
 */
@Override public TaskSpec makeTaskSpec(){
  int boardSize=gameState.getHeight() * gameState.getWidth();
  int numPieces=gameState.possibleBlocks.size();
  TaskSpecVRLGLUE3 theTaskSpecObject=new TaskSpecVRLGLUE3();
  theTaskSpecObject.setEpisodic();
  theTaskSpecObject.setDiscountFactor(1.0d);
  theTaskSpecObject.addDiscreteObservation(new IntRange(0,1,boardSize));
  theTaskSpecObject.addDiscreteObservation(new IntRange(0,1,numPieces));
  theTaskSpecObject.addDiscreteObservation(new IntRange(gameState.getHeight(),gameState.getHeight()));
  theTaskSpecObject.addDiscreteObservation(new IntRange(gameState.getWidth(),gameState.getWidth()));
  theTaskSpecObject.addDiscreteAction(new IntRange(0,5));
  theTaskSpecObject.setRewardRange(new DoubleRange(0,8.0d));
  theTaskSpecObject.setExtra("String_Node_Str" + gameState.getHeight() + "String_Node_Str"+ gameState.getWidth()+ "String_Node_Str"+ this.getClass().getPackage().getImplementationVersion());
  String taskSpecString=theTaskSpecObject.toTaskSpec();
  TaskSpec.checkTaskSpec(taskSpecString);
  TaskSpec.checkTaskSpec(taskSpecString);
  return new TaskSpec(theTaskSpecObject);
}

Fixed version (ground truth):
/** 
 * Method returns a taskspec that reflects the current game state
 * @return provides task details
 */
@Override public TaskSpec makeTaskSpec(){
  int boardSize=gameState.getHeight() * gameState.getWidth();
  int numPieces=TetrisState.POSSIBLE_BLOCKS.size();
  TaskSpecVRLGLUE3 theTaskSpecObject=new TaskSpecVRLGLUE3();
  theTaskSpecObject.setEpisodic();
  theTaskSpecObject.setDiscountFactor(1.0d);
  theTaskSpecObject.addDiscreteObservation(new IntRange(0,1,boardSize));
  theTaskSpecObject.addDiscreteObservation(new IntRange(0,1,numPieces));
  theTaskSpecObject.addDiscreteObservation(new IntRange(gameState.getHeight(),gameState.getHeight()));
  theTaskSpecObject.addDiscreteObservation(new IntRange(gameState.getWidth(),gameState.getWidth()));
  theTaskSpecObject.addDiscreteAction(new IntRange(0,5));
  theTaskSpecObject.setRewardRange(new DoubleRange(0,8.0d));
  theTaskSpecObject.setExtra("String_Node_Str" + gameState.getHeight() + "String_Node_Str"+ gameState.getWidth()+ "String_Node_Str"+ this.getClass().getPackage().getImplementationVersion());
  String taskSpecString=theTaskSpecObject.toTaskSpec();
  TaskSpec.checkTaskSpec(taskSpecString);
  TaskSpec.checkTaskSpec(taskSpecString);
  return new TaskSpec(theTaskSpecObject);
}
Program: 39205
Project: 39205
Buggy source:
/** 
 * This function checks every filled part of the 5x5 block array and sees if that piece is in bounds if the entire block is sitting at (checkX,checkY) on the board.
 * @param checkX X location of the left side of the 5x5 block array
 * @param checkY Y location of the top of the 5x5 block array
 * @param checkOrientation Orientation of the block to check
 * @return
 */
private boolean inBounds(int checkX,int checkY,int checkOrientation){
  try {
    int[][] thePiece=possibleBlocks.get(currentBlockId).getShape(checkOrientation);
    for (int y=0; y < thePiece[0].length; ++y) {
      for (int x=0; x < thePiece.length; ++x) {
        if (thePiece[x][y] != 0) {
          if (!(checkX + x >= 0 && checkX + x < worldWidth && checkY + y >= 0 && checkY + y < worldHeight)) {
            return false;
          }
        }
      }
    }
    return true;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    System.err.println("String_Node_Str" + checkX + "String_Node_Str"+ checkY+ "String_Node_Str"+ checkOrientation);
    System.err.println("String_Node_Str" + e);
    Thread.dumpStack();
    System.err.println("String_Node_Str");
    System.err.println("String_Node_Str");
    is_game_over=true;
    return false;
  }
}

Fixed version (ground truth):
/** 
 * This function checks every filled part of the 5x5 block array and sees if that piece is in bounds if the entire block is sitting at (checkX,checkY) on the board.
 * @param checkX X location of the left side of the 5x5 block array
 * @param checkY Y location of the top of the 5x5 block array
 * @param checkOrientation Orientation of the block to check
 * @return
 */
private boolean inBounds(int checkX,int checkY,int checkOrientation){
  try {
    int[][] thePiece=POSSIBLE_BLOCKS.get(currentBlockId).getShape(checkOrientation);
    for (int y=0; y < thePiece[0].length; ++y) {
      for (int x=0; x < thePiece.length; ++x) {
        if (thePiece[x][y] != 0) {
          if (!(checkX + x >= 0 && checkX + x < worldWidth && checkY + y >= 0 && checkY + y < worldHeight)) {
            return false;
          }
        }
      }
    }
    return true;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    System.err.println("String_Node_Str" + checkX + "String_Node_Str"+ checkY+ "String_Node_Str"+ checkOrientation);
    System.err.println("String_Node_Str" + e);
    Thread.dumpStack();
    System.err.println("String_Node_Str");
    System.err.println("String_Node_Str");
    is_game_over=true;
    return false;
  }
}
Program: 39206
Project: 39206
Buggy source:
public void writeCurrentBlock(int[] game_world){
  int[][] thisPiece=possibleBlocks.get(currentBlockId).getShape(currentRotation);
  for (int y=0; y < thisPiece[0].length; ++y) {
    for (int x=0; x < thisPiece.length; ++x) {
      if (thisPiece[x][y] != 0) {
        int linearIndex=calculateLinearArrayPosition(currentX + x,currentY + y);
        if (linearIndex < 0) {
          System.err.printf("String_Node_Str",linearIndex,currentX,x,currentY,y);
          Thread.dumpStack();
          System.exit(1);
        }
        game_world[linearIndex]=currentBlockId + 1;
      }
    }
  }
}

Fixed version (ground truth):
public void writeCurrentBlock(int[] game_world){
  int[][] thisPiece=POSSIBLE_BLOCKS.get(currentBlockId).getShape(currentRotation);
  for (int y=0; y < thisPiece[0].length; ++y) {
    for (int x=0; x < thisPiece.length; ++x) {
      if (thisPiece[x][y] != 0) {
        int linearIndex=calculateLinearArrayPosition(currentX + x,currentY + y);
        if (linearIndex < 0) {
          System.err.printf("String_Node_Str",linearIndex,currentX,x,currentY,y);
          Thread.dumpStack();
          System.exit(1);
        }
        game_world[linearIndex]=currentBlockId + 1;
      }
    }
  }
}
Program: 39207
Project: 39207
Buggy source:
/** 
 * Check if any filled part of the 5x5 block array is either out of bounds or overlapping with something in wordState
 * @param checkX X location of the left side of the 5x5 block array
 * @param checkY Y location of the top of the 5x5 block array
 * @param checkOrientation Orientation of the block to check
 * @return
 */
private boolean colliding(int checkX,int checkY,int checkOrientation){
  int[][] thePiece=possibleBlocks.get(currentBlockId).getShape(checkOrientation);
  try {
    for (int y=0; y < thePiece[0].length; ++y) {
      for (int x=0; x < thePiece.length; ++x) {
        if (thePiece[x][y] != 0) {
          if (checkY + y < 0 || checkX + x < 0) {
            return true;
          }
          if (checkY + y >= worldHeight || checkX + x >= worldWidth) {
            return true;
          }
          int linearArrayIndex=calculateLinearArrayPosition(checkX + x,checkY + y);
          if (worldState[linearArrayIndex] != 0) {
            return true;
          }
        }
      }
    }
    return false;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    System.err.println("String_Node_Str" + checkX + "String_Node_Str"+ checkY+ "String_Node_Str"+ checkOrientation);
    System.err.println("String_Node_Str" + e);
    Thread.dumpStack();
    System.err.println("String_Node_Str");
    System.err.println("String_Node_Str");
    is_game_over=true;
    return true;
  }
}

Fixed version (ground truth):
/** 
 * Check if any filled part of the 5x5 block array is either out of bounds or overlapping with something in wordState
 * @param checkX X location of the left side of the 5x5 block array
 * @param checkY Y location of the top of the 5x5 block array
 * @param checkOrientation Orientation of the block to check
 * @return
 */
private boolean colliding(int checkX,int checkY,int checkOrientation){
  int[][] thePiece=POSSIBLE_BLOCKS.get(currentBlockId).getShape(checkOrientation);
  try {
    for (int y=0; y < thePiece[0].length; ++y) {
      for (int x=0; x < thePiece.length; ++x) {
        if (thePiece[x][y] != 0) {
          if (checkY + y < 0 || checkX + x < 0) {
            return true;
          }
          if (checkY + y >= worldHeight || checkX + x >= worldWidth) {
            return true;
          }
          int linearArrayIndex=calculateLinearArrayPosition(checkX + x,checkY + y);
          if (worldState[linearArrayIndex] != 0) {
            return true;
          }
        }
      }
    }
    return false;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    System.err.println("String_Node_Str" + checkX + "String_Node_Str"+ checkY+ "String_Node_Str"+ checkOrientation);
    System.err.println("String_Node_Str" + e);
    Thread.dumpStack();
    System.err.println("String_Node_Str");
    System.err.println("String_Node_Str");
    is_game_over=true;
    return true;
  }
}
Program: 39208
Project: 39208
Buggy source:
public void spawn_block(){
  blockMobile=true;
  currentBlockId=randomGenerator.nextInt(possibleBlocks.size());
  currentRotation=0;
  currentX=(worldWidth / 2) - 2;
  currentY=-4;
  boolean hitOnWayIn=false;
  while (!inBounds(currentX,currentY,currentRotation)) {
    hitOnWayIn=collidingCheckOnlySpotsInBounds(currentX,currentY,currentRotation);
    currentY++;
  }
  is_game_over=colliding(currentX,currentY,currentRotation) || hitOnWayIn;
  if (is_game_over) {
    blockMobile=false;
  }
}

Fixed version (ground truth):
public void spawn_block(){
  blockMobile=true;
  currentBlockId=randomGenerator.nextInt(POSSIBLE_BLOCKS.size());
  currentRotation=0;
  currentX=(worldWidth / 2) - 2;
  currentY=-4;
  boolean hitOnWayIn=false;
  while (!inBounds(currentX,currentY,currentRotation)) {
    hitOnWayIn=collidingCheckOnlySpotsInBounds(currentX,currentY,currentRotation);
    currentY++;
  }
  is_game_over=colliding(currentX,currentY,currentRotation) || hitOnWayIn;
  if (is_game_over) {
    blockMobile=false;
  }
}
Program: 39209
Project: 39209
Buggy source:
/** 
 * Copy constructor
 * @param stateToCopy
 */
public TetrisState(TetrisState stateToCopy){
  this.blockMobile=stateToCopy.blockMobile;
  this.currentBlockId=stateToCopy.currentBlockId;
  this.currentRotation=stateToCopy.currentRotation;
  this.currentX=stateToCopy.currentX;
  this.currentY=stateToCopy.currentY;
  this.score=stateToCopy.score;
  this.is_game_over=stateToCopy.is_game_over;
  this.worldState=new int[stateToCopy.worldState.length];
  for (int i=0; i < this.worldState.length; i++) {
    this.worldState[i]=stateToCopy.worldState[i];
  }
  this.possibleBlocks=new Vector<TetrisPiece>();
  for (  TetrisPiece thisPiece : stateToCopy.possibleBlocks) {
    this.possibleBlocks.add(thisPiece);
  }
}

Fixed version (ground truth):
/** 
 * Copy constructor
 * @param stateToCopy
 */
public TetrisState(TetrisState stateToCopy){
  this.blockMobile=stateToCopy.blockMobile;
  this.currentBlockId=stateToCopy.currentBlockId;
  this.currentRotation=stateToCopy.currentRotation;
  this.currentX=stateToCopy.currentX;
  this.currentY=stateToCopy.currentY;
  this.score=stateToCopy.score;
  this.is_game_over=stateToCopy.is_game_over;
  this.worldState=new int[stateToCopy.worldState.length];
  for (int i=0; i < this.worldState.length; i++) {
    this.worldState[i]=stateToCopy.worldState[i];
  }
}
Program: 39210
Project: 39210
Buggy source:
public Observation get_observation(boolean includeMobile){
  try {
    int[] worldObservation=new int[worldState.length];
    for (int i=0; i < worldObservation.length; i++) {
      worldObservation[i]=worldState[i];
    }
    if (includeMobile)     writeCurrentBlock(worldObservation);
    Observation o=new Observation(TETRIS_STATE_NUMBER_OF_DISCRETE_FEATURES,0);
    for (int i=0; i < worldObservation.length; i++) {
      if (worldObservation[i] == 0) {
        o.intArray[i]=0;
      }
 else {
        o.intArray[i]=1;
      }
    }
    for (int j=0; j < possibleBlocks.size(); ++j) {
      o.intArray[worldObservation.length + j]=0;
    }
    o.intArray[worldObservation.length + currentBlockId]=1;
    o.intArray[TETRIS_STATE_CURRENT_X_INDEX]=this.currentX;
    o.intArray[TETRIS_STATE_CURRENT_Y_INDEX]=this.currentY;
    o.intArray[TETRIS_STATE_CURRENT_ROTATION_INDEX]=this.currentRotation;
    o.intArray[TETRIS_STATE_CURRENT_HEIGHT_INDEX]=getHeight();
    o.intArray[TETRIS_STATE_CURRENT_WIDTH_INDEX]=getWidth();
    return o;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    System.err.println("String_Node_Str");
    System.err.println("String_Node_Str" + e);
    Thread.dumpStack();
    System.err.println("String_Node_Str" + currentX + "String_Node_Str"+ currentY+ "String_Node_Str"+ currentRotation+ "String_Node_Str"+ currentBlockId);
    System.err.println("String_Node_Str");
    System.exit(1);
    return null;
  }
}

Fixed version (ground truth):
public Observation get_observation(boolean includeMobile){
  try {
    int[] worldObservation=new int[worldState.length];
    for (int i=0; i < worldObservation.length; i++) {
      worldObservation[i]=worldState[i];
    }
    if (includeMobile)     writeCurrentBlock(worldObservation);
    Observation o=new Observation(TETRIS_STATE_NUMBER_OF_DISCRETE_FEATURES,0);
    for (int i=0; i < worldObservation.length; i++) {
      if (worldObservation[i] == 0) {
        o.intArray[i]=0;
      }
 else {
        o.intArray[i]=1;
      }
    }
    for (int j=0; j < POSSIBLE_BLOCKS.size(); ++j) {
      o.intArray[worldObservation.length + j]=0;
    }
    o.intArray[worldObservation.length + currentBlockId]=1;
    o.intArray[TETRIS_STATE_CURRENT_X_INDEX]=this.currentX;
    o.intArray[TETRIS_STATE_CURRENT_Y_INDEX]=this.currentY;
    o.intArray[TETRIS_STATE_CURRENT_ROTATION_INDEX]=this.currentRotation;
    o.intArray[TETRIS_STATE_CURRENT_HEIGHT_INDEX]=getHeight();
    o.intArray[TETRIS_STATE_CURRENT_WIDTH_INDEX]=getWidth();
    return o;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    System.err.println("String_Node_Str");
    System.err.println("String_Node_Str" + e);
    Thread.dumpStack();
    System.err.println("String_Node_Str" + currentX + "String_Node_Str"+ currentY+ "String_Node_Str"+ currentRotation+ "String_Node_Str"+ currentBlockId);
    System.err.println("String_Node_Str");
    System.exit(1);
    return null;
  }
}
Program: 39211
Project: 39211
Buggy source:
private boolean collidingCheckOnlySpotsInBounds(int checkX,int checkY,int checkOrientation){
  int[][] thePiece=possibleBlocks.get(currentBlockId).getShape(checkOrientation);
  try {
    for (int y=0; y < thePiece[0].length; ++y) {
      for (int x=0; x < thePiece.length; ++x) {
        if (thePiece[x][y] != 0) {
          if ((checkX + x >= 0 && checkX + x < worldWidth && checkY + y >= 0 && checkY + y < worldHeight)) {
            int linearArrayIndex=calculateLinearArrayPosition(checkX + x,checkY + y);
            if (worldState[linearArrayIndex] != 0) {
              return true;
            }
          }
        }
      }
    }
    return false;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    System.err.println("String_Node_Str" + checkX + "String_Node_Str"+ checkY+ "String_Node_Str"+ checkOrientation);
    System.err.println("String_Node_Str" + e);
    Thread.dumpStack();
    System.err.println("String_Node_Str");
    System.err.println("String_Node_Str");
    is_game_over=true;
    return true;
  }
}

Fixed version (ground truth):
private boolean collidingCheckOnlySpotsInBounds(int checkX,int checkY,int checkOrientation){
  int[][] thePiece=POSSIBLE_BLOCKS.get(currentBlockId).getShape(checkOrientation);
  try {
    for (int y=0; y < thePiece[0].length; ++y) {
      for (int x=0; x < thePiece.length; ++x) {
        if (thePiece[x][y] != 0) {
          if ((checkX + x >= 0 && checkX + x < worldWidth && checkY + y >= 0 && checkY + y < worldHeight)) {
            int linearArrayIndex=calculateLinearArrayPosition(checkX + x,checkY + y);
            if (worldState[linearArrayIndex] != 0) {
              return true;
            }
          }
        }
      }
    }
    return false;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    System.err.println("String_Node_Str" + checkX + "String_Node_Str"+ checkY+ "String_Node_Str"+ checkOrientation);
    System.err.println("String_Node_Str" + e);
    Thread.dumpStack();
    System.err.println("String_Node_Str");
    System.err.println("String_Node_Str");
    is_game_over=true;
    return true;
  }
}
Program: 39212
Project: 39212
Buggy source:
/** 
 * String representation that may or may not include the currently falling piece
 * @param showFallingPiece Whether falling piece is part of representation
 * @return String representation of board
 */
public String toString(boolean showFallingPiece){
  int[][] thePiece=possibleBlocks.get(currentBlockId).getShape(this.currentRotation);
  String result="String_Node_Str";
  for (int y=0; y < worldHeight; y++) {
    for (int x=0; x < worldWidth; x++) {
      if (showFallingPiece && (currentY <= y && y < currentY + thePiece[0].length) && (currentX <= x && x < currentX + thePiece.length)) {
        result+=(int)Math.max(2 * thePiece[x - currentX][y - currentY],(worldState[y * worldWidth + x]));
      }
 else {
        result+=(worldState[y * worldWidth + x]) > 0 ? 1 : 0;
      }
    }
    result+=("String_Node_Str");
  }
  result+=("String_Node_Str");
  return result;
}

Fixed version (ground truth):
/** 
 * String representation that may or may not include the currently falling piece
 * @param showFallingPiece Whether falling piece is part of representation
 * @return String representation of board
 */
public String toString(boolean showFallingPiece){
  int[][] thePiece=POSSIBLE_BLOCKS.get(currentBlockId).getShape(this.currentRotation);
  String result="String_Node_Str";
  for (int y=0; y < worldHeight; y++) {
    for (int x=0; x < worldWidth; x++) {
      if (showFallingPiece && (currentY <= y && y < currentY + thePiece[0].length) && (currentX <= x && x < currentX + thePiece.length)) {
        result+=(int)Math.max(2 * thePiece[x - currentX][y - currentY],(worldState[y * worldWidth + x]));
      }
 else {
        result+=(worldState[y * worldWidth + x]) > 0 ? 1 : 0;
      }
    }
    result+=("String_Node_Str");
  }
  result+=("String_Node_Str");
  return result;
}
Program: 39214
Project: 39214
Buggy source:
@Override protected void saveSound(int i,JFileChooser chooser){
  SoundFromCPPNUtil.saveRemixedFileFromCPPN(scores.get(i).individual.getPhenotype(),WAVDoubleArray,Parameters.parameters.integerParameter("String_Node_Str"),playBackRate,playBackRate,inputMultipliers,chooser.getSelectedFile().getName() + "String_Node_Str");
}

Fixed version (ground truth):
@Override protected void saveSound(int i,JFileChooser chooser){
  SoundFromCPPNUtil.saveRemixedFileFromCPPN(scores.get(i).individual.getPhenotype(),WAVDoubleArray,Parameters.parameters.integerParameter("String_Node_Str"),playBackRate,playBackRate,inputMultipliers,chooser.getSelectedFile().getName() + "String_Node_Str",format);
}
Program: 39215
Project: 39215
Buggy source:
private static void init(AudioFormat format){
  try {
    DataLine.Info info=new DataLine.Info(SourceDataLine.class,format);
    line=(SourceDataLine)AudioSystem.getLine(info);
    line.open(format,SAMPLE_BUFFER_SIZE * format.getFrameSize());
    lineSave=(SourceDataLine)AudioSystem.getLine(info);
    lineSave.open(format,SAMPLE_BUFFER_SIZE * format.getFrameSize());
    buffer=new byte[SAMPLE_BUFFER_SIZE * format.getFrameSize() / 3];
  }
 catch (  LineUnavailableException e) {
    System.out.println(e.getMessage());
  }
  line.start();
}

Fixed version (ground truth):
private static void init(AudioFormat format){
  try {
    DataLine.Info info=new DataLine.Info(SourceDataLine.class,format);
    line=(SourceDataLine)AudioSystem.getLine(info);
    line.open(format,SAMPLE_BUFFER_SIZE * format.getFrameSize());
    buffer=new byte[SAMPLE_BUFFER_SIZE * format.getFrameSize() / 3];
  }
 catch (  LineUnavailableException e) {
    System.out.println(e.getMessage());
  }
  line.start();
}
Program: 39216
Project: 39216
Buggy source:
public static void changeAudioFormat(AudioFormat format){
  line.close();
  lineSave.close();
  init(format);
}

Fixed version (ground truth):
public static void changeAudioFormat(AudioFormat format){
  line.close();
  init(format);
}
Program: 39217
Project: 39217
Buggy source:
/** 
 * Saves the double array as an audio file (using .wav or .au format). Fully functional for saving file generated from CPPNs
 * @param filename the name of the audio file
 * @param samples the array of samples
 * @throws IllegalArgumentException if unable to save {@code filename}
 * @throws IllegalArgumentException if {@code samples} is {@code null}
 */
public static void saveFileFromDoubleArray(String filename,double[] samples){
  if (samples == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  AudioFormat format=new AudioFormat(PlayDoubleArray.SAMPLE_RATE,16,1,true,false);
  byte[] data=new byte[2 * samples.length];
  for (int i=0; i < samples.length; i++) {
    int temp=(short)(samples[i] * PlayDoubleArray.MAX_16_BIT);
    data[2 * i + 0]=(byte)temp;
    data[2 * i + 1]=(byte)(temp >> 8);
  }
  try {
    ByteArrayInputStream bais=new ByteArrayInputStream(data);
    AudioInputStream ais=new AudioInputStream(bais,format,samples.length);
    if (filename.endsWith("String_Node_Str") || filename.endsWith("String_Node_Str")) {
      AudioSystem.write(ais,AudioFileFormat.Type.WAVE,new File(filename));
    }
 else     if (filename.endsWith("String_Node_Str") || filename.endsWith("String_Node_Str")) {
      AudioSystem.write(ais,AudioFileFormat.Type.AU,new File(filename));
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + filename + "String_Node_Str");
    }
  }
 catch (  IOException ioe) {
    throw new IllegalArgumentException("String_Node_Str" + filename + "String_Node_Str",ioe);
  }
}

Fixed version (ground truth):
public static void saveFileFromDoubleArray(String filename,double[] samples,AudioFormat format){
  if (samples == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  byte[] data=new byte[2 * samples.length];
  for (int i=0; i < samples.length; i++) {
    int temp=(short)(samples[i] * PlayDoubleArray.MAX_16_BIT);
    data[2 * i + 0]=(byte)temp;
    data[2 * i + 1]=(byte)(temp >> 8);
  }
  try {
    ByteArrayInputStream bais=new ByteArrayInputStream(data);
    AudioInputStream ais=new AudioInputStream(bais,format,samples.length);
    if (filename.endsWith("String_Node_Str") || filename.endsWith("String_Node_Str")) {
      AudioSystem.write(ais,AudioFileFormat.Type.WAVE,new File(filename));
    }
 else     if (filename.endsWith("String_Node_Str") || filename.endsWith("String_Node_Str")) {
      AudioSystem.write(ais,AudioFileFormat.Type.AU,new File(filename));
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + filename + "String_Node_Str");
    }
  }
 catch (  IOException ioe) {
    throw new IllegalArgumentException("String_Node_Str" + filename + "String_Node_Str",ioe);
  }
}
Program: 39218
Project: 39218
Buggy source:
/** 
 * Uses a double array of amplitudes and a CPPN to generate a remixed sound and saves that  output into a file.
 * @param CPPN network used to generate amplitude
 * @param inputWAV double array representing WAV file being remixed
 * @param length length of sample
 * @param frequency Frequency of note being manipulated
 * @param sampleRate specified rate of input wav file 
 * @param inputMultipliers double array determining whether checkboxes have been turned on or off in Breedesizer
 * @param fileName String representation of location where generated file will be saved
 */
public static void saveRemixedFileFromCPPN(Network cppn,double[] inputWAV,int length,double frequency,int sampleRate,double[] inputMultipliers,String fileName){
  double[] generatedSound=amplitudeRemixer(cppn,inputWAV,length,frequency,sampleRate,inputMultipliers);
  SaveFromArray.saveFileFromDoubleArray(fileName,generatedSound);
}

Fixed version (ground truth):
/** 
 * Uses a double array of amplitudes and a CPPN to generate a remixed sound and saves that  output into a file.
 * @param CPPN network used to generate amplitude
 * @param inputWAV double array representing WAV file being remixed
 * @param length length of sample
 * @param frequency Frequency of note being manipulated
 * @param sampleRate specified rate of input wav file 
 * @param inputMultipliers double array determining whether checkboxes have been turned on or off in Breedesizer
 * @param fileName String representation of location where generated file will be saved
 * @param format 
 */
public static void saveRemixedFileFromCPPN(Network cppn,double[] inputWAV,int length,double frequency,int sampleRate,double[] inputMultipliers,String fileName,AudioFormat format){
  double[] generatedSound=amplitudeRemixer(cppn,inputWAV,length,frequency,sampleRate,inputMultipliers);
  SaveFromArray.saveFileFromDoubleArray(fileName,generatedSound,format);
}
Program: 39219
Project: 39219
Buggy source:
/** 
 * Doesn't work - makes 8 bit files playable, but they don't sound like original file. Converting AudioFormat of files directly isn't the best way to go
 * @param format AudioFormat of source wave
 * @return adjusted format specified to 16 bits, 2 bytes/frame, and a signed PCM encoding
 */
public static AudioFormat getAudioFormatRestrictedTo16Bits(AudioFormat format){
  float sampleRate=format.getSampleRate();
  int channels=format.getChannels();
  boolean endian=format.isBigEndian();
  float frameRate=format.getFrameRate();
  AudioFormat adjustedFormat=new AudioFormat(Encoding.PCM_SIGNED,sampleRate,PlayDoubleArray.BITS_PER_SAMPLE,channels,PlayDoubleArray.BYTES_PER_SAMPLE,frameRate,endian);
  return adjustedFormat;
}

Fixed version (ground truth):
/** 
 * Doesn't work - makes 8 bit files playable, but they don't sound like original file. Converting AudioFormat of files directly isn't the best way to go
 * @param format AudioFormat of source wave
 * @return adjusted format specified to 16 bits, 2 bytes/frame, and a signed PCM encoding
 */
private static AudioFormat getAudioFormatRestrictedTo16Bits(AudioFormat format){
  float sampleRate=format.getSampleRate();
  int channels=format.getChannels();
  boolean endian=format.isBigEndian();
  float frameRate=format.getFrameRate();
  AudioFormat adjustedFormat=new AudioFormat(Encoding.PCM_SIGNED,sampleRate,PlayDoubleArray.BITS_PER_SAMPLE,channels,PlayDoubleArray.BYTES_PER_SAMPLE,frameRate,endian);
  return adjustedFormat;
}
Program: 39221
Project: 39221
Buggy source:
/** 
 * Method that inputs an AudioInputStream, calls method that extracts amplitude byte array from the audio input stream, and returns a method call using the resulting byte array to  extractAmplitudeDataFromAmplitudeByteArray(). 
 * @param audioInputStream stream of audio being converted into amplitude data
 * @return  method call that extracts amplitude data from byte array formed
 */
public static int[] extractAmplitudeDataFromAudioInputStream(AudioInputStream audioInputStream){
  AudioFormat format=audioInputStream.getFormat();
  byte[] audioBytes=extractAmplitudeByteArrayFromAudioInputStream(audioInputStream);
  return extractAmplitudeDataFromAmplitudeByteArray(format,audioBytes);
}

Fixed version (ground truth):
/** 
 * Method that inputs an AudioInputStream, calls method that extracts amplitude byte array from the audio input stream, and returns a method call using the resulting byte array to  extractAmplitudeDataFromAmplitudeByteArray(). 
 * @param audioInputStream stream of audio being converted into amplitude data
 * @return  method call that extracts amplitude data from byte array formed
 */
public static int[] extractAmplitudeDataFromAudioInputStream(AudioInputStream audioInputStream){
  AudioFormat format=audioInputStream.getFormat();
  PlayDoubleArray.changeAudioFormat(format);
  byte[] audioBytes=extractAmplitudeByteArrayFromAudioInputStream(audioInputStream);
  return extractAmplitudeDataFromAmplitudeByteArray(format,audioBytes);
}
Program: 39222
Project: 39222
Buggy source:
public static void main(String[] rags){
  Parameters.initializeParameterCollections(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  System.out.println(Parameters.parameters.booleanParameter("String_Node_Str"));
}

Fixed version (ground truth):
public static void main(String[] rags){
  Parameters.initializeParameterCollections(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  System.out.println();
}
Program: 39223
Project: 39223
Buggy source:
/** 
 * @param value :value to be converted
 * @param max largest possible number in this category
 * @return value on a scale from -1 to 1 with 1 being max
 */
private double normalize(double value,double max){
  return (value / max) - 2;
}

Fixed version (ground truth):
/** 
 * precondition: max > 0, min = 0.
 * @param value :value to be converted
 * @param max largest possible number in this category
 * @return value on a scale from -1 to 1 with 1 being max
 */
private double normalize(double value,double max){
  return (2 * value - max) / max;
}
Program: 39224
Project: 39224
Buggy source:
/** 
 * uses information collected over time in MicroRTSTask.oneEval
 */
@Override public Pair<double[],double[]> getFitness(GameState gs){
  double[] fitness=new double[]{task.getHarvestingEfficiency(),normalize(task.getBaseUpTime(),maxCycles),task.getAverageUnitDifference()};
  Pair<double[],double[]> result=new Pair<double[],double[]>(fitness,null);
  return result;
}

Fixed version (ground truth):
/** 
 * uses information collected over time in MicroRTSTask.oneEval
 */
@Override public Pair<double[],double[]> getFitness(GameState gs){
  double[] fitness=new double[]{normalize(task.getHarvestingEfficiency(),maxCycles * task.getResourceGainValue()),normalize(task.getBaseUpTime(),maxCycles),normalize(task.getAverageUnitDifference(),pgs.getHeight() * pgs.getWidth())};
  Pair<double[],double[]> result=new Pair<double[],double[]>(fitness,null);
  return result;
}
Program: 39225
Project: 39225
Buggy source:
/** 
 * scores performance in a game
 * @param terminalGameState
 * @return pair of double[], the first of which has {victory, time, unitDifference}
 */
private Pair<double[],double[]> fitnessFunction(GameState terminalGameState){
  Pair<double[],double[]> score=new Pair<>(new double[3],new double[0]);
  int gameEndTime=terminalGameState.getTime();
  List<Unit> unitsLeft=terminalGameState.getUnits();
  if (terminalGameState.winner() == 0) {
    score.t1[0]=1;
    score.t1[1]=(double)(MAXCYCLES - gameEndTime) / MAXCYCLES * RESULTRANGE - 1;
    for (    Unit u : unitsLeft) {
      if (u.getType().name != "String_Node_Str")       score.t1[2]+=u.getType().cost;
    }
  }
 else   if (terminalGameState.winner() == 1) {
    score.t1[0]=-1;
    score.t1[1]=(double)(MAXCYCLES - gameEndTime) / MAXCYCLES * -1 * RESULTRANGE + 1;
    for (    Unit u : unitsLeft) {
      if (u.getType().name != "String_Node_Str")       score.t1[2]-=u.getType().cost;
    }
  }
 else   if (terminalGameState.winner() == -1) {
    score.t1[0]=0;
    for (    Unit u : unitsLeft) {
      if (u.getPlayer() == 0)       score.t1[2]+=u.getType().cost;
 else       if (u.getPlayer() == 1)       score.t1[2]-=u.getType().cost;
    }
    score.t1[1]=-1 * score.t1[2];
  }
  System.out.println("String_Node_Str" + score.t1[0] + "String_Node_Str"+ score.t1[2]+ "String_Node_Str"+ score.t1[1]);
  return score;
}

Fixed version (ground truth):
/** 
 * scores performance in a game
 * @param terminalGameState
 * @return pair of double[], the first of which has {victory, time, unitDifference}
 */
private Pair<double[],double[]> fitnessFunction(GameState terminalGameState){
  Pair<double[],double[]> score=new Pair<>(new double[3],new double[0]);
  int gameEndTime=terminalGameState.getTime();
  List<Unit> unitsLeft=terminalGameState.getUnits();
  if (terminalGameState.winner() == 0) {
    score.t1[0]=1;
    score.t1[1]=(double)(MAXCYCLES - gameEndTime) / MAXCYCLES * RESULTRANGE - 1;
    for (    Unit u : unitsLeft) {
      if (u.getType().name != "String_Node_Str")       score.t1[2]+=u.getType().cost;
    }
  }
 else   if (terminalGameState.winner() == 1) {
    score.t1[0]=-1;
    score.t1[1]=(double)(MAXCYCLES - gameEndTime) / MAXCYCLES * -1 * RESULTRANGE + 1;
    for (    Unit u : unitsLeft) {
      if (u.getType().name != "String_Node_Str")       score.t1[2]-=u.getType().cost;
    }
  }
 else   if (terminalGameState.winner() == -1) {
    score.t1[0]=0;
    for (    Unit u : unitsLeft) {
      if (u.getPlayer() == 0)       score.t1[2]+=u.getType().cost;
 else       if (u.getPlayer() == 1)       score.t1[2]-=u.getType().cost;
    }
    score.t1[1]=-1 * score.t1[2] / (pgs.getHeight() * pgs.getWidth());
  }
  System.out.println("String_Node_Str" + score.t1[0] + "String_Node_Str"+ score.t1[2]+ "String_Node_Str"+ score.t1[1]);
  return score;
}
Program: 39226
Project: 39226
Buggy source:
private Pair<double[],double[]> fitnessFunction(GameState terminalGameState){
  Pair<double[],double[]> score=new Pair<>(new double[3],new double[0]);
  int gameEndTime=terminalGameState.getTime();
  List<Unit> unitsLeft=terminalGameState.getUnits();
  System.out.println(unitsLeft.get(6).getType().name);
  if (terminalGameState.winner() == 0) {
    score.t1[0]=1;
    score.t1[1]=(double)(MAXCYCLES - gameEndTime) / MAXCYCLES * RESULTRANGE - 1;
    for (    Unit u : unitsLeft) {
      if (u.getType().name != "String_Node_Str")       score.t1[2]+=u.getType().cost;
    }
  }
 else {
    score.t1[0]=-1;
    score.t1[1]=(double)(MAXCYCLES - gameEndTime) / MAXCYCLES * -1 * RESULTRANGE + 1;
    for (    Unit u : unitsLeft) {
      if (u.getType().name != "String_Node_Str")       score.t1[2]-=u.getType().cost;
    }
  }
  System.out.println(score);
  return score;
}

Fixed version (ground truth):
/** 
 * scores performance in a game
 * @param terminalGameState
 * @return pair of double[], the first of which has {victory, time, unitDifference}
 */
private Pair<double[],double[]> fitnessFunction(GameState terminalGameState){
  Pair<double[],double[]> score=new Pair<>(new double[3],new double[0]);
  int gameEndTime=terminalGameState.getTime();
  List<Unit> unitsLeft=terminalGameState.getUnits();
  if (terminalGameState.winner() == 0) {
    score.t1[0]=1;
    score.t1[1]=(double)(MAXCYCLES - gameEndTime) / MAXCYCLES * RESULTRANGE - 1;
    for (    Unit u : unitsLeft) {
      if (u.getType().name != "String_Node_Str")       score.t1[2]+=u.getType().cost;
    }
  }
 else {
    score.t1[0]=-1;
    score.t1[1]=(double)(MAXCYCLES - gameEndTime) / MAXCYCLES * -1 * RESULTRANGE + 1;
    for (    Unit u : unitsLeft) {
      if (u.getType().name != "String_Node_Str")       score.t1[2]-=u.getType().cost;
    }
  }
  return score;
}
Program: 39227
Project: 39227
Buggy source:
/** 
 * all actions performed in a single evaluation of a genotype loop taken from GameVisualSimulationTest, the rest based on MsPacManTask.oneEval()
 * @param individual genotype to be evaluated
 * @param num which evaluation is currently being performed
 * @return Combination of fitness scores (multiobjective possible), andother scores (for tracking non-fitness data)
 */
@Override public Pair<double[],double[]> oneEval(Genotype<T> individual,int num){
  GameState gs=new GameState(pgs,utt);
  boolean gameover=false;
  ef.setNetwork(individual);
  AI ai1=new UCT(100,-1,100,10,new RandomBiasedAI(),ef);
  AI ai2=new RandomBiasedAI();
  JFrame w=null;
  if (CommonConstants.watch)   w=PhysicalGameStatePanel.newVisualizer(gs,640,640,false,PhysicalGameStatePanel.COLORSCHEME_BLACK);
  do {
    PlayerAction pa1;
    try {
      pa1=ai1.getAction(0,gs);
      gs.issueSafe(pa1);
    }
 catch (    Exception e) {
      System.out.println("String_Node_Str");
      e.printStackTrace();
    }
    PlayerAction pa2;
    try {
      pa2=ai2.getAction(1,gs);
      gs.issueSafe(pa2);
    }
 catch (    Exception e) {
      System.out.println("String_Node_Str");
      e.printStackTrace();
    }
    gameover=gs.cycle();
    if (CommonConstants.watch) {
      w.repaint();
    }
  }
 while (!gameover && gs.getTime() < MAXCYCLES);
  return fitnessFunction(gs);
}

Fixed version (ground truth):
/** 
 * all actions performed in a single evaluation of a genotype loop taken from GameVisualSimulationTest, the rest based on MsPacManTask.oneEval()
 * @param individual genotype to be evaluated
 * @param num which evaluation is currently being performed
 * @return Combination of fitness scores (multiobjective possible), andother scores (for tracking non-fitness data)
 */
@Override public Pair<double[],double[]> oneEval(Genotype<T> individual,int num){
  boolean gameover=false;
  utt=new UnitTypeTable();
  try {
    pgs=PhysicalGameState.load("String_Node_Str",utt);
  }
 catch (  JDOMException|IOException e) {
    e.printStackTrace();
    System.exit(1);
  }
  GameState gs=new GameState(pgs,utt);
  ef.setNetwork(individual);
  AI ai1=new UCT(100,-1,100,10,new RandomBiasedAI(),ef);
  AI ai2=new RandomBiasedAI();
  JFrame w=null;
  if (CommonConstants.watch)   w=PhysicalGameStatePanel.newVisualizer(gs,640,640,false,PhysicalGameStatePanel.COLORSCHEME_BLACK);
  do {
    PlayerAction pa1;
    try {
      pa1=ai1.getAction(0,gs);
      gs.issueSafe(pa1);
    }
 catch (    Exception e) {
      System.out.println("String_Node_Str");
      e.printStackTrace();
    }
    PlayerAction pa2;
    try {
      pa2=ai2.getAction(1,gs);
      gs.issueSafe(pa2);
    }
 catch (    Exception e) {
      System.out.println("String_Node_Str");
      e.printStackTrace();
    }
    gameover=gs.cycle();
    if (CommonConstants.watch) {
      w.repaint();
      try {
        Thread.sleep(1);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
 while (!gameover && gs.getTime() < MAXCYCLES);
  return fitnessFunction(gs);
}
Program: 39230
Project: 39230
Buggy source:
/** 
 * Returns the number of Objectives for the PinballTask
 * @return 1, The number of Objectives for the PinballTask
 */
@Override public int numObjectives(){
  return 1;
}

Fixed version (ground truth):
/** 
 * Returns the number of Objectives for the PinballTask
 * @return 1, The number of Objectives for the PinballTask
 */
@Override public int numObjectives(){
  if (Parameters.parameters.booleanParameter("String_Node_Str")) {
    return 2;
  }
 else {
    return 1;
  }
}
Program: 39231
Project: 39231
Buggy source:
/** 
 * @param offspringScore
 * @param g1
 * @param bestScore
 * @param g2
 * @param drawingPanel
 * @param objective
 */
private static void drawScoreSegment(double offspringScore,int g1,double bestScore,int g2,DrawingPanel drawingPanel,int objective){
  int offset=Plot.OFFSET;
  Graphics2D g=drawingPanel.getGraphics();
  g.setColor(Color.red);
  double max=maxes.get(objective);
  double min=mins.get(objective);
  double maxRange=Math.max(max,max - min);
  double lowerMin=Math.min(0,min);
  int x1=offset + Plot.scale(g1,bestScores[objective].length * 1.0,0);
  int y1=offset + Plot.invert(offspringScore,maxRange,lowerMin);
  int x2=offset + Plot.scale(g2,bestScores[objective].length * 1.0,0);
  int y2=offset + Plot.invert(bestScore,maxRange,lowerMin);
  g.drawLine(x1,y1,x2,y2);
}

Fixed version (ground truth):
/** 
 * @param offspringScore
 * @param g1
 * @param bestScore
 * @param g2
 * @param drawingPanel
 * @param objective
 */
private static void drawScoreSegment(double offspringScore,int g1,double bestScore,int g2,DrawingPanel drawingPanel,int objective){
  int offset=Plot.OFFSET;
  Graphics2D g=drawingPanel.getGraphics();
  g.setColor(Color.red);
  double max=maxes.get(objective);
  double min=mins.get(objective);
  double maxRange=Math.max(max,max - min);
  double lowerMin=Math.min(0,min);
  int x1=offset + GraphicsUtil.scale(g1,bestScores[objective].length * 1.0,0);
  int y1=offset + GraphicsUtil.invert(offspringScore,maxRange,lowerMin);
  int x2=offset + GraphicsUtil.scale(g2,bestScores[objective].length * 1.0,0);
  int y2=offset + GraphicsUtil.invert(bestScore,maxRange,lowerMin);
  g.drawLine(x1,y1,x2,y2);
}
Program: 39232
Project: 39232
Buggy source:
/** 
 * @param x
 * @param index
 * @return
 */
private static int scale(double x,int index){
  return Plot.scale(x,maxes.get(index) - mins.get(index),mins.get(index));
}

Fixed version (ground truth):
/** 
 * @param x
 * @param index
 * @return
 */
private static int scale(double x,int index){
  return GraphicsUtil.scale(x,maxes.get(index) - mins.get(index),mins.get(index));
}
Program: 39234
Project: 39234
Buggy source:
/** 
 * Given the whole population, log several summary statistics.
 * @param scores Population of scores from this generation
 * @param generation Particular generation being logged
 */
private void logStats(ArrayList<Score<T>> scores,int generation){
  double[][] nextStage=new double[scores.size()][];
  for (int i=0; i < scores.size(); i++) {
    Score<T> s=scores.get(i);
    double[] combined=new double[s.scores.length + s.otherStats.length];
    System.arraycopy(s.scores,0,combined,0,s.scores.length);
    System.arraycopy(s.otherStats,0,combined,s.scores.length,s.otherStats.length);
    nextStage[i]=combined;
  }
  logAverages(nextStage,generation);
  if (draw) {
    int objectives=nextStage[0].length;
    if (panels == null) {
      initPanels(objectives);
    }
    for (int i=0; i < objectives; i++) {
      panels[i].clear();
      Plot.linePlot(panels[i],overallMins[i],overallMaxes[i],allMaxes.get(i),Color.magenta);
      Plot.linePlot(panels[i],overallMins[i],overallMaxes[i],allAverages.get(i),Color.blue);
      Plot.linePlot(panels[i],overallMins[i],overallMaxes[i],allMins.get(i),Color.green);
    }
  }
}

Fixed version (ground truth):
/** 
 * Given the whole population, log several summary statistics.
 * @param scores Population of scores from this generation
 * @param generation Particular generation being logged
 */
private void logStats(ArrayList<Score<T>> scores,int generation){
  double[][] nextStage=new double[scores.size()][];
  for (int i=0; i < scores.size(); i++) {
    Score<T> s=scores.get(i);
    double[] combined=new double[s.scores.length + s.otherStats.length];
    System.arraycopy(s.scores,0,combined,0,s.scores.length);
    System.arraycopy(s.otherStats,0,combined,s.scores.length,s.otherStats.length);
    nextStage[i]=combined;
  }
  logAverages(nextStage,generation);
  if (draw) {
    int objectives=nextStage[0].length;
    if (panels == null) {
      initPanels(objectives);
    }
    for (int i=0; i < objectives; i++) {
      panels[i].clear();
      GraphicsUtil.linePlot(panels[i],overallMins[i],overallMaxes[i],allMaxes.get(i),Color.magenta);
      GraphicsUtil.linePlot(panels[i],overallMins[i],overallMaxes[i],allAverages.get(i),Color.blue);
      GraphicsUtil.linePlot(panels[i],overallMins[i],overallMaxes[i],allMins.get(i),Color.green);
    }
  }
}
Program: 39235
Project: 39235
Buggy source:
private void refreshPreferencePlot(DrawingPanel preferenceNeuronPanel,double[] preferences){
  preferenceNeuronPanel.clear();
  for (int i=0; i < preferenceActivationHistory.length; i++) {
    preferenceActivationHistory[i].add(preferences[i]);
    Plot.linePlot(preferenceNeuronPanel,-1,1,preferenceActivationHistory[i],CombinatoricUtilities.colorFromInt(i));
  }
}

Fixed version (ground truth):
private void refreshPreferencePlot(DrawingPanel preferenceNeuronPanel,double[] preferences){
  preferenceNeuronPanel.clear();
  for (int i=0; i < preferenceActivationHistory.length; i++) {
    preferenceActivationHistory[i].add(preferences[i]);
    GraphicsUtil.linePlot(preferenceNeuronPanel,-1,1,preferenceActivationHistory[i],CombinatoricUtilities.colorFromInt(i));
  }
}
Program: 39237
Project: 39237
Buggy source:
/** 
 * Creates a graphed visualization of an audio file by taking in the file represented as a list of doubles and  plotting it using a DrawingPanel.
 * @param fileName String reference to file being plotted
 */
public static void wavePlot(String fileName){
  double[] fileArray=read(fileName);
  ArrayList<Double> fileArrayList=ArrayUtil.doubleVectorFromArray(fileArray);
  DrawingPanel panel=new DrawingPanel(500,500,"String_Node_Str" + fileName);
  Plot.linePlot(panel,-1.0,1.0,fileArrayList,Color.black);
}

Fixed version (ground truth):
/** 
 * Creates a graphed visualization of an audio file by taking in the file represented as a list of doubles and  plotting it using a DrawingPanel.
 * @param fileName String reference to file being plotted
 */
public static void wavePlot(String fileName){
  double[] fileArray=read(fileName);
  ArrayList<Double> fileArrayList=ArrayUtil.doubleVectorFromArray(fileArray);
  DrawingPanel panel=new DrawingPanel(500,500,"String_Node_Str" + fileName);
  GraphicsUtil.linePlot(panel,-1.0,1.0,fileArrayList,Color.black);
}