nus-yam/ex-repair huggingface dataset:
Program: 39105
Project: 39105
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public JsonObject switchUserOrg(@RequestParam int orgId){
  Map<String,String> headers=new HashMap<String,String>();
  String grafanaCookie=getUserCookies();
  headers.put("String_Node_Str",grafanaCookie);
  Map<String,String> grafanaResponseCookies=new HashMap<String,String>();
  String grafanaCurrentOrg=getGrafanaCurrentOrg(headers);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrg);
  String grafanaCurrentOrgRole=getCurrentOrgRole(headers,grafanaCurrentOrg);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrgRole);
  httpRequest.setAttribute("String_Node_Str",grafanaResponseCookies);
  Authentication auth=SecurityContextHolder.getContext().getAuthentication();
  List<GrantedAuthority> updatedAuthorities=new ArrayList<>(auth.getAuthorities());
  updatedAuthorities.add(SpringAuthority.valueOf(grafanaCurrentOrgRole));
  Authentication newAuth=new UsernamePasswordAuthenticationToken(auth.getPrincipal(),auth.getCredentials(),updatedAuthorities);
  SecurityContextHolder.getContext().setAuthentication(newAuth);
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str" + orgId;
  ClientResponse response=RestHandler.doPost(apiUrl,null,headers);
  return PlatformServiceUtil.buildSuccessResponseWithData(new JsonParser().parse(response.getEntity(String.class)));
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public JsonObject switchUserOrg(@RequestParam int orgId){
  Map<String,String> headers=new HashMap<String,String>();
  String grafanaCookie=getUserCookies();
  headers.put("String_Node_Str",grafanaCookie);
  Map<String,String> grafanaResponseCookies=new HashMap<String,String>();
  String grafanaCurrentOrg=getGrafanaCurrentOrg(headers);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrg);
  String grafanaCurrentOrgRole=getCurrentOrgRole(headers,grafanaCurrentOrg);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrgRole);
  httpRequest.setAttribute("String_Node_Str",grafanaResponseCookies);
  Authentication auth=SecurityContextHolder.getContext().getAuthentication();
  List<GrantedAuthority> updatedAuthorities=new ArrayList<>(auth.getAuthorities());
  updatedAuthorities.add(SpringAuthorityUtil.getSpringAuthorityRole(grafanaCurrentOrgRole));
  Authentication newAuth=new UsernamePasswordAuthenticationToken(auth.getPrincipal(),auth.getCredentials(),updatedAuthorities);
  SecurityContextHolder.getContext().setAuthentication(newAuth);
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str" + orgId;
  ClientResponse response=RestHandler.doPost(apiUrl,null,headers);
  return PlatformServiceUtil.buildSuccessResponseWithData(new JsonParser().parse(response.getEntity(String.class)));
}
Program: 39107
Project: 39107
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public JsonObject switchUserOrg(@RequestParam int orgId){
  Map<String,String> headers=new HashMap<String,String>();
  String grafanaCookie=getUserCookies();
  headers.put("String_Node_Str",grafanaCookie);
  Map<String,String> grafanaResponseCookies=new HashMap<String,String>();
  String grafanaCurrentOrg=getGrafanaCurrentOrg(headers);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrg);
  String grafanaCurrentOrgRole=getCurrentOrgRole(headers,grafanaCurrentOrg);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrgRole);
  httpRequest.setAttribute("String_Node_Str",grafanaResponseCookies);
  Authentication auth=SecurityContextHolder.getContext().getAuthentication();
  List<GrantedAuthority> updatedAuthorities=new ArrayList<>(auth.getAuthorities());
  updatedAuthorities.add(SpringAuthority.valueOf(grafanaCurrentOrgRole.replaceAll("String_Node_Str","String_Node_Str")));
  Authentication newAuth=new UsernamePasswordAuthenticationToken(auth.getPrincipal(),auth.getCredentials(),updatedAuthorities);
  SecurityContextHolder.getContext().setAuthentication(newAuth);
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str" + orgId;
  ClientResponse response=RestHandler.doPost(apiUrl,null,headers);
  return PlatformServiceUtil.buildSuccessResponseWithData(new JsonParser().parse(response.getEntity(String.class)));
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public JsonObject switchUserOrg(@RequestParam int orgId){
  Map<String,String> headers=new HashMap<String,String>();
  String grafanaCookie=getUserCookies();
  headers.put("String_Node_Str",grafanaCookie);
  Map<String,String> grafanaResponseCookies=new HashMap<String,String>();
  String grafanaCurrentOrg=getGrafanaCurrentOrg(headers);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrg);
  String grafanaCurrentOrgRole=getCurrentOrgRole(headers,grafanaCurrentOrg);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrgRole);
  httpRequest.setAttribute("String_Node_Str",grafanaResponseCookies);
  Authentication auth=SecurityContextHolder.getContext().getAuthentication();
  List<GrantedAuthority> updatedAuthorities=new ArrayList<>(auth.getAuthorities());
  updatedAuthorities.add(SpringAuthorityUtil.getSpringAuthorityRole(grafanaCurrentOrgRole));
  Authentication newAuth=new UsernamePasswordAuthenticationToken(auth.getPrincipal(),auth.getCredentials(),updatedAuthorities);
  SecurityContextHolder.getContext().setAuthentication(newAuth);
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str" + orgId;
  ClientResponse response=RestHandler.doPost(apiUrl,null,headers);
  return PlatformServiceUtil.buildSuccessResponseWithData(new JsonParser().parse(response.getEntity(String.class)));
}
Program: 39109
Project: 39109
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public JsonObject switchUserOrg(@RequestParam int orgId){
  Map<String,String> headers=new HashMap<String,String>();
  String grafanaCookie=getUserCookies();
  headers.put("String_Node_Str",grafanaCookie);
  Map<String,String> grafanaResponseCookies=new HashMap<String,String>();
  String grafanaCurrentOrg=getGrafanaCurrentOrg(headers);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrg);
  String grafanaCurrentOrgRole=getCurrentOrgRole(headers,grafanaCurrentOrg);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrgRole);
  httpRequest.setAttribute("String_Node_Str",grafanaResponseCookies);
  Authentication auth=SecurityContextHolder.getContext().getAuthentication();
  List<GrantedAuthority> updatedAuthorities=new ArrayList<>(auth.getAuthorities());
  updatedAuthorities.add(SpringAuthority.valueOf(grafanaCurrentOrgRole));
  Authentication newAuth=new UsernamePasswordAuthenticationToken(auth.getPrincipal(),auth.getCredentials(),updatedAuthorities);
  SecurityContextHolder.getContext().setAuthentication(newAuth);
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str" + orgId;
  ClientResponse response=RestHandler.doPost(apiUrl,null,headers);
  return PlatformServiceUtil.buildSuccessResponseWithData(new JsonParser().parse(response.getEntity(String.class)));
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public JsonObject switchUserOrg(@RequestParam int orgId){
  Map<String,String> headers=new HashMap<String,String>();
  String grafanaCookie=getUserCookies();
  headers.put("String_Node_Str",grafanaCookie);
  Map<String,String> grafanaResponseCookies=new HashMap<String,String>();
  String grafanaCurrentOrg=getGrafanaCurrentOrg(headers);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrg);
  String grafanaCurrentOrgRole=getCurrentOrgRole(headers,grafanaCurrentOrg);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrgRole);
  httpRequest.setAttribute("String_Node_Str",grafanaResponseCookies);
  Authentication auth=SecurityContextHolder.getContext().getAuthentication();
  List<GrantedAuthority> updatedAuthorities=new ArrayList<>(auth.getAuthorities());
  updatedAuthorities.add(SpringAuthority.valueOf(grafanaCurrentOrgRole.replaceAll("String_Node_Str","String_Node_Str")));
  Authentication newAuth=new UsernamePasswordAuthenticationToken(auth.getPrincipal(),auth.getCredentials(),updatedAuthorities);
  SecurityContextHolder.getContext().setAuthentication(newAuth);
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str" + orgId;
  ClientResponse response=RestHandler.doPost(apiUrl,null,headers);
  return PlatformServiceUtil.buildSuccessResponseWithData(new JsonParser().parse(response.getEntity(String.class)));
}
Program: 39111
Project: 39111
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public @ResponseBody String grafanaEndPoint(){
  ApplicationConfigProvider applicationConfig=ApplicationConfigProvider.getInstance();
  return applicationConfig.getGrafana().getGrafanaEndpoint();
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public @ResponseBody JsonObject grafanaEndPoint(){
  ApplicationConfigProvider applicationConfig=ApplicationConfigProvider.getInstance();
  JsonObject jsonResponse=new JsonObject();
  jsonResponse.addProperty(PlatformServiceConstants.STATUS,PlatformServiceConstants.SUCCESS);
  jsonResponse.addProperty("String_Node_Str",applicationConfig.getGrafana().getGrafanaEndpoint());
  return jsonResponse;
}
Program: 39112
Project: 39112
Buggy source:
public static String[] generateLevelFromCPPN(TWEANN net,int width){
  String[] level=new String[LEVEL_HEIGHT];
  double halfWidth=width / 2.0;
  for (int i=LEVEL_HEIGHT - 1; i >= 0; i--) {
    level[i]="String_Node_Str";
    for (int j=0; j < width; j++) {
      double x=(j - halfWidth) / halfWidth;
      double y=(MAX_HEIGHT_INDEX - i) / MAX_HEIGHT_INDEX;
      double[] inputs=new double[]{x,y,1.0};
      double[] outputs=net.process(inputs);
      System.out.println("String_Node_Str" + i + "String_Node_Str"+ j+ "String_Node_Str"+ Arrays.toString(inputs)+ Arrays.toString(outputs));
      if (outputs[PRESENT_INDEX] > PRESENT_THRESHOLD) {
        outputs[PRESENT_INDEX]=Double.NEGATIVE_INFINITY;
        int highest=StatisticsUtilities.argmax(outputs);
        if (highest == SOLID_INDEX) {
          level[i]+=SOLID_CHAR;
        }
 else         if (highest == BLOCK_OR_QUESTION_INDEX) {
          level[i]+=BLOCK_CHAR;
        }
 else         if (highest == COIN_INDEX) {
          level[i]+=COIN_CHAR;
        }
 else         if (highest == ENEMY_INDEX && i + 1 < level.length && level[i + 1].charAt(j) != EMPTY_CHAR && level[i + 1].charAt(j) != ENEMY_CHAR && level[i + 1].charAt(j) != COIN_CHAR) {
          level[i]+=ENEMY_CHAR;
        }
 else {
          level[i]+=EMPTY_CHAR;
        }
      }
 else {
        level[i]+=EMPTY_CHAR;
      }
    }
  }
  return level;
}

Fixed version (ground truth):
public static String[] generateLevelFromCPPN(TWEANN net,int width){
  String[] level=new String[LEVEL_HEIGHT];
  double halfWidth=width / 2.0;
  char[] top=new char[width];
  Arrays.fill(top,EMPTY_CHAR);
  level[0]=new String(top);
  for (int i=LEVEL_HEIGHT - 1; i > 0; i--) {
    level[i]="String_Node_Str";
    for (int j=0; j < width; j++) {
      double x=(j - halfWidth) / halfWidth;
      double y=(MAX_HEIGHT_INDEX - i) / MAX_HEIGHT_INDEX;
      double[] inputs=new double[]{x,y,1.0};
      double[] outputs=net.process(inputs);
      System.out.println("String_Node_Str" + i + "String_Node_Str"+ j+ "String_Node_Str"+ Arrays.toString(inputs)+ Arrays.toString(outputs));
      if (outputs[PRESENT_INDEX] > PRESENT_THRESHOLD) {
        outputs[PRESENT_INDEX]=Double.NEGATIVE_INFINITY;
        int highest=StatisticsUtilities.argmax(outputs);
        if (highest == SOLID_INDEX) {
          level[i]+=SOLID_CHAR;
        }
 else         if (highest == BLOCK_OR_QUESTION_INDEX) {
          level[i]+=BLOCK_CHAR;
        }
 else         if (highest == COIN_INDEX) {
          level[i]+=COIN_CHAR;
        }
 else         if (highest == ENEMY_INDEX && i + 1 < level.length) {
          level[i]+=ENEMY_CHAR;
        }
 else {
          level[i]+=EMPTY_CHAR;
        }
      }
 else {
        level[i]+=EMPTY_CHAR;
      }
    }
  }
  return level;
}
Program: 39113
Project: 39113
Buggy source:
public static void init(GraphicsConfiguration gc){
  try {
    mario=cutImage(gc,"String_Node_Str",32,32);
    smallMario=cutImage(gc,"String_Node_Str",16,16);
    fireMario=cutImage(gc,"String_Node_Str",32,32);
    enemies=cutImage(gc,"String_Node_Str",16,32);
    items=cutImage(gc,"String_Node_Str",16,16);
    level=cutImage(gc,"String_Node_Str",16,16);
    map=cutImage(gc,"String_Node_Str",16,16);
    particles=cutImage(gc,"String_Node_Str",8,8);
    bg=cutImage(gc,"String_Node_Str",32,32);
    logo=getImage(gc,"String_Node_Str");
    titleScreen=getImage(gc,"String_Node_Str");
    font=cutImage(gc,"String_Node_Str",8,8);
    endScene=cutImage(gc,"String_Node_Str",96,96);
    gameOver=cutImage(gc,"String_Node_Str",96,64);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void init(GraphicsConfiguration gc){
  if (loaded)   return;
  try {
    mario=cutImage(gc,"String_Node_Str",32,32);
    smallMario=cutImage(gc,"String_Node_Str",16,16);
    fireMario=cutImage(gc,"String_Node_Str",32,32);
    enemies=cutImage(gc,"String_Node_Str",16,32);
    items=cutImage(gc,"String_Node_Str",16,16);
    level=cutImage(gc,"String_Node_Str",16,16);
    map=cutImage(gc,"String_Node_Str",16,16);
    particles=cutImage(gc,"String_Node_Str",8,8);
    bg=cutImage(gc,"String_Node_Str",32,32);
    logo=getImage(gc,"String_Node_Str");
    titleScreen=getImage(gc,"String_Node_Str");
    font=cutImage(gc,"String_Node_Str",8,8);
    endScene=cutImage(gc,"String_Node_Str",96,96);
    gameOver=cutImage(gc,"String_Node_Str",96,64);
    loaded=true;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 39114
Project: 39114
Buggy source:
/** 
 * A Graphics2D object and a Level are sent in, along with some information about the area to view. The level is then drawn to the Graphics2D, which is modified by side effects.
 * @param g
 * @param level
 * @param x0
 * @param y0
 * @param w
 * @param h
 */
public static void renderArea(Graphics2D g,Level level,int x0,int y0,int xCam,int yCam,int w,int h){
  Art.init(GraphicsUtil.getConfiguration());
  g.setBackground(transparent);
  g.clearRect(x0,y0,w,h);
  int xTileStart=(x0 + xCam) / 16;
  int yTileStart=(y0 + yCam) / 16;
  int xTileEnd=(x0 + xCam + w) / 16;
  int yTileEnd=(y0 + yCam + h) / 16;
  for (int x=xTileStart; x <= xTileEnd; x++) {
    for (int y=yTileStart; y <= yTileEnd; y++) {
      int b=level.getBlock(x,y) & 0xff;
      if (((Level.TILE_BEHAVIORS[b]) & Level.BIT_ANIMATED) == 0) {
        g.drawImage(Art.level[b % 16][b / 16],(x << 4) - xCam,(y << 4) - yCam,null);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * A Graphics2D object and a Level are sent in, along with some information about the area to view. The level is then drawn to the Graphics2D, which is modified by side effects.
 * @param g
 * @param level
 * @param x0
 * @param y0
 * @param w
 * @param h
 */
public static void renderArea(Graphics2D g,Level level,int x0,int y0,int xCam,int yCam,int w,int h){
  Art.init(GraphicsUtil.getConfiguration());
  g.setBackground(transparent);
  g.clearRect(x0,y0,w,h);
  int xTileStart=(x0 + xCam) / 16;
  int yTileStart=(y0 + yCam) / 16;
  int xTileEnd=(x0 + xCam + w) / 16;
  int yTileEnd=(y0 + yCam + h) / 16;
  for (int x=xTileStart; x <= xTileEnd; x++) {
    for (int y=yTileStart; y <= yTileEnd; y++) {
      int b=level.getBlock(x,y) & 0xff;
      g.drawImage(Art.level[b % 16][b / 16],(x << 4) - xCam,(y << 4) - yCam,null);
    }
  }
}
Program: 39115
Project: 39115
Buggy source:
/** 
 * Close the Mario window
 */
public static void DestroyMarioComponentFrame(){
  marioComponentFrame.dispose();
}

Fixed version (ground truth):
/** 
 * Close the Mario window
 */
public static void DestroyMarioComponentFrame(){
  marioComponentFrame.dispose();
  marioComponentFrame=null;
}
Program: 39116
Project: 39116
Buggy source:
/** 
 * Specified agent plays the specified level with visual display
 * @param level
 * @param agent
 * @return
 */
public static double[] agentPlaysLevel(Level level,Agent agent){
  EvaluationOptions options=new CmdLineOptions(new String[]{});
  options.setAgent(agent);
  ProgressTask task=new ProgressTask(options);
  options.setLevel(level);
  task.setOptions(options);
  return task.evaluate(options.getAgent());
}

Fixed version (ground truth):
/** 
 * Specified agent plays the specified level with visual display
 * @param level
 * @param agent
 * @return
 */
public static double[] agentPlaysLevel(Level level,Agent agent){
  EvaluationOptions options=new CmdLineOptions(new String[]{});
  options.setAgent(agent);
  ProgressTask task=new ProgressTask(options);
  options.setLevel(level);
  task.setOptions(options);
  double[] result=task.evaluate(options.getAgent());
  ToolsConfigurator.DestroyMarioComponentFrame();
  return result;
}
Program: 39117
Project: 39117
Buggy source:
public LevelBreederTask() throws IllegalAccessException {
  super();
  VGDLFactory.GetInstance().init();
  VGDLRegistry.GetInstance().init();
  gameFile=Parameters.parameters.stringParameter("String_Node_Str");
  fullGameFile=GAMES_PATH + gameFile + "String_Node_Str";
  gameCharData=SPECIFIC_GAME_LEVEL_CHARS.get(gameFile);
}

Fixed version (ground truth):
public LevelBreederTask() throws IllegalAccessException {
  super();
  VGDLFactory.GetInstance().init();
  VGDLRegistry.GetInstance().init();
  gameFile=Parameters.parameters.stringParameter("String_Node_Str");
  fullGameFile=GAMES_PATH + gameFile + "String_Node_Str";
  gameCharData=SPECIFIC_GAME_LEVEL_CHARS.get(gameFile);
  JButton play=new JButton("String_Node_Str");
  play.setName("String_Node_Str" + PLAY_BUTTON_INDEX);
  play.addActionListener(this);
  top.add(play);
}
Program: 39118
Project: 39118
Buggy source:
@Override protected BufferedImage getButtonImage(T phenotype,int width,int height,double[] inputMultipliers){
  String[] level=GVGAIUtil.generateLevelFromCPPN(phenotype,GAME_GRID_WIDTH,GAME_GRID_HEIGHT,DEFAULT_FLOOR,DEFAULT_WALL,gameCharData[FIXED_ITEMS_INDEX],gameCharData[UNIQUE_ITEMS_INDEX],gameCharData[RANDOM_ITEMS_INDEX],NUMBER_RANDOM_ITEMS);
  int seed=0;
  Agent agent=new Agent();
  agent.setup(null,seed,true);
  Game game=new VGDLParser().parseGame(fullGameFile);
  BufferedImage levelImage=GVGAIUtil.getLevelImage(((BasicGame)game),level,agent,width,height,seed);
  return levelImage;
}

Fixed version (ground truth):
@Override protected BufferedImage getButtonImage(T phenotype,int width,int height,double[] inputMultipliers){
  GameBundle bundle=setUpGameWithLevelFromCPPN(phenotype);
  BufferedImage levelImage=GVGAIUtil.getLevelImage(((BasicGame)bundle.game),bundle.level,(Agent)bundle.agent,width,height,bundle.randomSeed);
  return levelImage;
}
Program: 39119
Project: 39119
Buggy source:
/** 
 * Resets to a new random population
 */
@SuppressWarnings("String_Node_Str") protected void reset(){
  ArrayList<Genotype<T>> newPop=((SinglePopulationGenerationalEA<T>)MMNEAT.ea).initialPopulation(scores.get(0).individual);
  scores=new ArrayList<Score<T>>();
  ActivationFunctionRandomReplacement frr=new ActivationFunctionRandomReplacement();
  for (int i=0; i < newPop.size(); i++) {
    frr.mutate((Genotype<TWEANN>)newPop.get(i));
    resetButton(newPop.get(i),i);
  }
}

Fixed version (ground truth):
/** 
 * Resets to a new random population
 */
@SuppressWarnings("String_Node_Str") protected void reset(){
  CommonConstants.ftype=RandomNumbers.randomElement(ActivationFunctions.availableActivationFunctions);
  Parameters.parameters.setInteger("String_Node_Str",CommonConstants.ftype);
  ArrayList<Genotype<T>> newPop=((SinglePopulationGenerationalEA<T>)MMNEAT.ea).initialPopulation(scores.get(0).individual);
  scores=new ArrayList<Score<T>>();
  ActivationFunctionRandomReplacement frr=new ActivationFunctionRandomReplacement();
  for (int i=0; i < newPop.size(); i++) {
    frr.mutate((Genotype<TWEANN>)newPop.get(i));
    resetButton(newPop.get(i),i);
  }
}
Program: 39120
Project: 39120
Buggy source:
private static void setupTWEANNGenotypeDataTracking(boolean coevolution){
  if (genotype instanceof TWEANNGenotype) {
    if (Parameters.parameters.booleanParameter("String_Node_Str") && Parameters.parameters.booleanParameter("String_Node_Str")) {
      System.out.println("String_Node_Str");
      EvolutionaryHistory.initTWEANNLog();
    }
    if (!coevolution) {
      EvolutionaryHistory.initArchetype(0);
    }
    long biggestInnovation=((TWEANNGenotype)genotype).biggestInnovation();
    if (biggestInnovation > EvolutionaryHistory.largestUnusedInnovationNumber) {
      EvolutionaryHistory.setInnovation(biggestInnovation + 1);
    }
  }
}

Fixed version (ground truth):
private static void setupTWEANNGenotypeDataTracking(boolean coevolution){
  if (genotype instanceof TWEANNGenotype || genotype instanceof CombinedGenotype) {
    if (Parameters.parameters.booleanParameter("String_Node_Str") && Parameters.parameters.booleanParameter("String_Node_Str")) {
      System.out.println("String_Node_Str");
      EvolutionaryHistory.initTWEANNLog();
    }
    if (!coevolution) {
      EvolutionaryHistory.initArchetype(0);
    }
    @SuppressWarnings("String_Node_Str") long biggestInnovation=genotype instanceof CombinedGenotype ? ((TWEANNGenotype)((CombinedGenotype)genotype).t1).biggestInnovation() : ((TWEANNGenotype)genotype).biggestInnovation();
    if (biggestInnovation > EvolutionaryHistory.largestUnusedInnovationNumber) {
      EvolutionaryHistory.setInnovation(biggestInnovation + 1);
    }
  }
}
Program: 39122
Project: 39122
Buggy source:
/** 
 * Given an ArchivedOrganism (which contains some evaluation information about the genotype), figure out which bin it belongs in and add it at the front if it is a new elite. Otherwise, add it at the end.
 * @param candidate Organism containing genotype and eval information
 * @return Whether organism was a new elite
 */
public boolean add(Score<T> candidate){
  String binLabel=mapping.binForScore(candidate);
  boolean newElite=true;
  ArrayList<Score<T>> bin;
  if (!archive.containsKey(binLabel)) {
    bin=new ArrayList<Score<T>>();
    bin.add(candidate);
  }
 else {
    bin=archive.get(binLabel);
    Score<T> elite=bin.get(0);
    if (candidate.isAtLeastAsGood(elite)) {
      bin.add(0,candidate);
    }
 else {
      bin.add(candidate);
      newElite=false;
    }
  }
  archive.put(binLabel,bin);
  if (saveElites) {
    String fileName="String_Node_Str" + candidate.individual.getId() + "String_Node_Str";
    if (newElite) {
      fileName="String_Node_Str" + fileName;
    }
    String binPath=archiveDir + File.separator + binLabel;
    new File(binPath).mkdirs();
    Easy.save(candidate.individual,binPath + File.separator + fileName);
  }
  return newElite;
}

Fixed version (ground truth):
/** 
 * Given an ArchivedOrganism (which contains some evaluation information about the genotype), figure out which bin it belongs in and add it at the front if it is a new elite. Otherwise, add it at the end.
 * @param candidate Organism containing genotype and eval information
 * @return Whether organism was a new elite
 */
public boolean add(Score<T> candidate){
  String binLabel=mapping.binForScore(candidate);
  boolean newElite=true;
  ArrayList<Score<T>> bin;
  if (!archive.containsKey(binLabel)) {
    bin=new ArrayList<Score<T>>();
    bin.add(candidate);
  }
 else {
    bin=archive.get(binLabel);
    Score<T> elite=bin.get(0);
    if (candidate.isAtLeastAsGood(elite)) {
      bin.add(0,candidate);
    }
 else {
      bin.add(candidate);
      newElite=false;
    }
  }
  archive.put(binLabel,bin);
  if (newElite)   System.out.println("String_Node_Str" + binLabel + "String_Node_Str"+ candidate.scores[0]);
  if (saveElites) {
    String fileName="String_Node_Str" + candidate.individual.getId() + "String_Node_Str";
    if (newElite) {
      fileName="String_Node_Str" + fileName;
    }
    String binPath=archiveDir + File.separator + binLabel;
    new File(binPath).mkdirs();
    Easy.save(candidate.individual,binPath + File.separator + fileName);
  }
  return newElite;
}
Program: 39124
Project: 39124
Buggy source:
@Override public Score<T> evaluate(Genotype<T> individual){
  Network cppn=individual.getPhenotype();
  BufferedImage image=GraphicsUtil.imageFromCPPN(cppn,ImageNetClassification.IMAGE_NET_INPUT_WIDTH,ImageNetClassification.IMAGE_NET_INPUT_HEIGHT);
  INDArray imageArray=ImageNetClassification.bufferedImageToINDArray(image);
  INDArray scores=ImageNetClassification.getImageNetPredictions(imageArray,PREPROCESS);
  double bestScore=ImageNetClassification.bestScore(scores);
  ArrayList<Double> behaviorVector=ArrayUtil.doubleVectorFromINDArray(scores);
  Score<T> result=new Score<>(individual,new double[]{bestScore},behaviorVector);
  if (CommonConstants.watch) {
    DrawingPanel p=GraphicsUtil.drawImage(image,"String_Node_Str",ImageNetClassification.IMAGE_NET_INPUT_WIDTH,ImageNetClassification.IMAGE_NET_INPUT_HEIGHT);
    String decodedLabels=new ImageNetLabels().decodePredictions(scores);
    System.out.println(decodedLabels);
    MiscUtil.waitForReadStringAndEnterKeyPress();
    p.dispose();
  }
  return result;
}

Fixed version (ground truth):
@Override public Score<T> evaluate(Genotype<T> individual){
  Network cppn=individual.getPhenotype();
  BufferedImage image=GraphicsUtil.imageFromCPPN(cppn,ImageNetClassification.IMAGE_NET_INPUT_WIDTH,ImageNetClassification.IMAGE_NET_INPUT_HEIGHT);
  INDArray imageArray=ImageNetClassification.bufferedImageToINDArray(image);
  INDArray scores=ImageNetClassification.getImageNetPredictions(imageArray,PREPROCESS);
  double bestScore=ImageNetClassification.bestScore(scores);
  ArrayList<Double> behaviorVector=ArrayUtil.doubleVectorFromINDArray(scores);
  Score<T> result=new Score<>(individual,new double[]{bestScore},behaviorVector);
  DrawingPanel picture=null;
  if (CommonConstants.watch || CommonConstants.netio) {
    picture=GraphicsUtil.drawImage(image,"String_Node_Str",ImageNetClassification.IMAGE_NET_INPUT_WIDTH,ImageNetClassification.IMAGE_NET_INPUT_HEIGHT);
  }
  if (CommonConstants.watch) {
    String decodedLabels=new ImageNetLabels().decodePredictions(scores);
    System.out.println(decodedLabels);
    MiscUtil.waitForReadStringAndEnterKeyPress();
  }
  if (CommonConstants.netio) {
    @SuppressWarnings("String_Node_Str") Archive<T> archive=((MAPElites<T>)MMNEAT.ea).getArchive();
    String fileName="String_Node_Str" + individual.getId() + "String_Node_Str";
    String binLabel=archive.getBinMapping().binForScore(result);
    String binPath=archive.getArchiveDirectory() + File.separator + binLabel;
    new File(binPath).mkdirs();
    picture.save(binPath + File.separator + fileName);
  }
  if (picture != null)   picture.dispose();
  return result;
}
Program: 39125
Project: 39125
Buggy source:
/** 
 * Converts a 1D INDArray from DL4J into an ArrayList of Doubles
 * @param values An INDArray that must be 1D
 * @return ArrayList with same values in same order
 */
public static ArrayList<Double> doubleVectorFromINDArray(INDArray values){
  ArrayList<Double> result=new ArrayList<Double>(values.size(0));
  for (int i=0; i < values.size(0); i++) {
    result.add(values.getDouble(0,i));
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Converts a 1D INDArray from DL4J into an ArrayList of Doubles
 * @param values An INDArray that must be 1D
 * @return ArrayList with same values in same order
 */
public static ArrayList<Double> doubleVectorFromINDArray(INDArray values){
  ArrayList<Double> result=new ArrayList<Double>(values.size(0));
  for (int i=0; i < values.length(); i++) {
    result.add(values.getDouble(0,i));
  }
  return result;
}
Program: 39128
Project: 39128
Buggy source:
/** 
 * Calculates the total number of features. Equation is set up in such a way to allow for an array of inputs to take in certain inputs.
 */
@Override public int numFeatures(){
  return worldWidth + (worldWidth - 1) + (CommonConstants.hyperNEAT ? 2 : 3);
}

Fixed version (ground truth):
/** 
 * Calculates the total number of features. Equation is set up in such a way to allow for an array of inputs to take in certain inputs.
 */
@Override public int numFeatures(){
  return worldWidth + (worldWidth - 1) + (CommonConstants.hyperNEAT || CommonConstants.hybrID ? 2 : 3);
}
Program: 39129
Project: 39129
Buggy source:
/** 
 * Extract focuses on finding the holes in the current world state. A hole being a non occupied space beneath an occupied space.
 * @param o Observation 
 * @return array of inputs
 */
@Override public double[] extract(Observation o){
  double[] inputs=new double[numFeatures()];
  int[] worldState=new int[worldWidth * worldHeight];
  System.arraycopy(o.intArray,0,worldState,0,worldWidth * worldHeight);
  int in=0;
  double holes=0;
  int firstHeightIndex=in;
  double maxHeight=0;
  for (int i=0; i < worldWidth; i++) {
    double h=columnHeight(i,worldState);
    holes+=columnHoles(i,worldState,(int)h);
    maxHeight=Math.max(h,maxHeight);
    inputs[in++]=h;
  }
  for (int i=0; i < worldWidth - 1; i++) {
    inputs[in++]=Math.abs(inputs[firstHeightIndex + i] - inputs[firstHeightIndex + i + 1]);
  }
  inputs[in++]=maxHeight;
  inputs[in++]=holes;
  if (!CommonConstants.hyperNEAT) {
    inputs[in++]=1;
  }
  return inputs;
}

Fixed version (ground truth):
/** 
 * Extract focuses on finding the holes in the current world state. A hole being a non occupied space beneath an occupied space.
 * @param o Observation 
 * @return array of inputs
 */
@Override public double[] extract(Observation o){
  double[] inputs=new double[numFeatures()];
  int[] worldState=new int[worldWidth * worldHeight];
  System.arraycopy(o.intArray,0,worldState,0,worldWidth * worldHeight);
  int in=0;
  double holes=0;
  int firstHeightIndex=in;
  double maxHeight=0;
  for (int i=0; i < worldWidth; i++) {
    double h=columnHeight(i,worldState);
    holes+=columnHoles(i,worldState,(int)h);
    maxHeight=Math.max(h,maxHeight);
    inputs[in++]=h;
  }
  for (int i=0; i < worldWidth - 1; i++) {
    inputs[in++]=Math.abs(inputs[firstHeightIndex + i] - inputs[firstHeightIndex + i + 1]);
  }
  inputs[in++]=maxHeight;
  inputs[in++]=holes;
  if (!CommonConstants.hyperNEAT && !CommonConstants.hybrID) {
    inputs[in++]=1;
  }
  return inputs;
}
Program: 39130
Project: 39130
Buggy source:
/** 
 * Returns an array of feature labels given the current extractor
 */
@Override public String[] featureLabels(){
  String[] labels=new String[numFeatures()];
  int in=0;
  for (int i=0; i < worldWidth; i++) {
    labels[in++]="String_Node_Str" + i + "String_Node_Str";
  }
  for (int i=0; i < worldWidth - 1; i++) {
    labels[in++]="String_Node_Str" + i + "String_Node_Str"+ (i + 1)+ "String_Node_Str";
  }
  labels[in++]="String_Node_Str";
  labels[in++]="String_Node_Str";
  if (!CommonConstants.hyperNEAT) {
    labels[in++]="String_Node_Str";
  }
  return labels;
}

Fixed version (ground truth):
/** 
 * Returns an array of feature labels given the current extractor
 */
@Override public String[] featureLabels(){
  String[] labels=new String[numFeatures()];
  int in=0;
  for (int i=0; i < worldWidth; i++) {
    labels[in++]="String_Node_Str" + i + "String_Node_Str";
  }
  for (int i=0; i < worldWidth - 1; i++) {
    labels[in++]="String_Node_Str" + i + "String_Node_Str"+ (i + 1)+ "String_Node_Str";
  }
  labels[in++]="String_Node_Str";
  labels[in++]="String_Node_Str";
  if (!CommonConstants.hyperNEAT && !CommonConstants.hybrID) {
    labels[in++]="String_Node_Str";
  }
  return labels;
}
Program: 39131
Project: 39131
Buggy source:
/** 
 * Takes raw features and scales them to range [0,1] for neural network input.
 * @param inputs
 * @return scaled inputs
 */
@Override public double[] scaleInputs(double[] inputs){
  double[] next=new double[inputs.length];
  int height_features=TetrisState.worldWidth + (TetrisState.worldWidth - 1) + 1;
  for (int i=0; i < height_features; i++) {
    next[i]=inputs[i] / TetrisState.worldHeight;
  }
  next[height_features]=inputs[height_features] / TetrisState.TETRIS_STATE_NUMBER_WORLD_GRID_BLOCKS;
  if (!CommonConstants.hyperNEAT) {
    next[height_features + 1]=1.0;
  }
  return next;
}

Fixed version (ground truth):
/** 
 * Takes raw features and scales them to range [0,1] for neural network input.
 * @param inputs
 * @return scaled inputs
 */
@Override public double[] scaleInputs(double[] inputs){
  double[] next=new double[inputs.length];
  int height_features=TetrisState.worldWidth + (TetrisState.worldWidth - 1) + 1;
  for (int i=0; i < height_features; i++) {
    next[i]=inputs[i] / TetrisState.worldHeight;
  }
  next[height_features]=inputs[height_features] / TetrisState.TETRIS_STATE_NUMBER_WORLD_GRID_BLOCKS;
  if (!CommonConstants.hyperNEAT && !CommonConstants.hybrID) {
    next[height_features + 1]=1.0;
  }
  return next;
}
Program: 39134
Project: 39134
Buggy source:
/** 
 * Adds checkboxes for disabling certain input values
 */
public void inputCheckBoxes(){
  String[] inputLabels=this.sensorLabels();
  inputMultipliers=new double[inputLabels.length];
  for (int i=0; i < inputLabels.length; i++) {
    String label=inputLabels[i].replaceAll("String_Node_Str","String_Node_Str");
    JCheckBox inputEffect=new JCheckBox(label,true);
    inputMultipliers[i]=1.0;
    inputEffect.setName("String_Node_Str" + (CHECKBOX_IDENTIFIER_START - i));
    inputEffect.addActionListener(this);
    inputEffect.setForeground(new Color(0,0,0));
    if (!simplifiedInteractiveInterface) {
      top.add(inputEffect);
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds checkboxes for disabling certain input values
 */
public void inputCheckBoxes(){
  String[] inputLabels=this.sensorLabels();
  inputMultipliers=new double[inputLabels.length];
  for (int i=0; i < inputLabels.length; i++) {
    String label=inputLabels[i].replaceAll("String_Node_Str","String_Node_Str");
    JCheckBox inputEffect=new JCheckBox(label,true);
    inputMultipliers[i]=1.0;
    inputEffect.setName("String_Node_Str" + (CHECKBOX_IDENTIFIER_START - i));
    inputEffect.addActionListener(this);
    inputEffect.setForeground(new Color(0,0,0));
    if (!Parameters.parameters.booleanParameter("String_Node_Str")) {
      top.add(inputEffect);
    }
  }
}
Program: 39139
Project: 39139
Buggy source:
@Override public BufferedImage[] getAnimationImages(T cppn,int startFrame,int endFrame,boolean beingSaved){
  return AnimationUtil.shapesFromCPPN(cppn,picSize,picSize,startFrame,endFrame,color,heading,pitch,inputMultipliers);
}

Fixed version (ground truth):
@Override public BufferedImage[] getAnimationImages(T cppn,int startFrame,int endFrame,boolean beingSaved){
  return AnimationUtil.shapesFromCPPN(cppn,picSize,picSize,startFrame,endFrame,beingSaved ? Color.BLACK : null,heading,pitch,inputMultipliers);
}
Program: 39141
Project: 39141
Buggy source:
/** 
 * Returns the current image to be displayed on the button based on the rotation  and the CPPN.
 * @param cppn Network manipulating image
 * @param imageWidth width of image
 * @param imageHeight height of image
 * @param sideLength size of cube
 * @param shapeWidth width of shape (measured in cubes)
 * @param shapeHeight height of shape (measured in cubes)
 * @param shapeDepth depth of shape (measured in cubes)
 * @param color desired color of image
 * @param heading horizontal rotation of object
 * @param pitch vertical rotation of object
 * @param inputMultipliers indicates whether input checkboxes are turned on or off
 * @return
 */
public static BufferedImage currentImageFromCPPN(Network cppn,int imageWidth,int imageHeight,int sideLength,int shapeWidth,int shapeHeight,int shapeDepth,Color color,double heading,double pitch,double[] inputMultipliers,double time){
  List<Triangle> tris=trianglesFromCPPN(cppn,imageWidth,imageHeight,sideLength,shapeWidth,shapeHeight,shapeDepth,color,inputMultipliers,time);
  BufferedImage currentImage=imageFromTriangles(tris,imageWidth,imageHeight,heading,pitch,color);
  return currentImage;
}

Fixed version (ground truth):
/** 
 * Returns the current image to be displayed on the button based on the rotation  and the CPPN.
 * @param cppn Network manipulating image
 * @param imageWidth width of image
 * @param imageHeight height of image
 * @param sideLength size of cube
 * @param shapeWidth width of shape (measured in cubes)
 * @param shapeHeight height of shape (measured in cubes)
 * @param shapeDepth depth of shape (measured in cubes)
 * @param bgColor desired color of image
 * @param heading horizontal rotation of object
 * @param pitch vertical rotation of object
 * @param inputMultipliers indicates whether input checkboxes are turned on or off
 * @return
 */
public static BufferedImage currentImageFromCPPN(Network cppn,int imageWidth,int imageHeight,int sideLength,int shapeWidth,int shapeHeight,int shapeDepth,Color bgColor,double heading,double pitch,double[] inputMultipliers,double time){
  List<Triangle> tris=trianglesFromCPPN(cppn,imageWidth,imageHeight,sideLength,shapeWidth,shapeHeight,shapeDepth,null,inputMultipliers,time);
  BufferedImage currentImage=imageFromTriangles(tris,imageWidth,imageHeight,heading,pitch,bgColor);
  return currentImage;
}
Program: 39143
Project: 39143
Buggy source:
/** 
 * Adds a given List of Champions into the Hall Of Fame
 * @param generation Generation of the Champions being put in the Hall Of Fame
 * @param newChamps List of Genotypes from the Champions being saved
 */
public void addChampions(int generation,List<Pair<Genotype<T>,Score<T>>> newChamps){
  if (Parameters.parameters.booleanParameter("String_Node_Str")) {
    for (    Triple<Integer,Genotype<T>,Score<T>> tr : hall) {
      for (      Pair<Genotype<T>,Score<T>> champ : newChamps) {
        if (champ.t2.isAtLeastAsGood(tr.t3))         hall.remove(tr);
        if (tr.t3.isBetter(champ.t2))         newChamps.remove(champ);
      }
    }
    for (    Pair<Genotype<T>,Score<T>> champion : newChamps) {
      hall.add(new Triple<Integer,Genotype<T>,Score<T>>(generation,champion.t1,champion.t2));
    }
  }
 else {
    for (    Pair<Genotype<T>,Score<T>> champion : newChamps) {
      hall.add(new Triple<Integer,Genotype<T>,Score<T>>(generation,champion.t1,champion.t2));
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds a given List of Champions into the Hall Of Fame
 * @param generation Generation of the Champions being put in the Hall Of Fame
 * @param newChampsList List of Genotypes from the Champions being saved
 */
public void addChampions(int generation,List<Pair<Genotype<T>,Score<T>>> newChampsList){
  if (Parameters.parameters.booleanParameter("String_Node_Str")) {
    Iterator<Triple<Integer,Genotype<T>,Score<T>>> itr=hall.iterator();
    while (itr.hasNext()) {
      Triple<Integer,Genotype<T>,Score<T>> oldChamp=itr.next();
      Iterator<Pair<Genotype<T>,Score<T>>> itr2=newChampsList.iterator();
      while (itr2.hasNext()) {
        Pair<Genotype<T>,Score<T>> newChamp=itr2.next();
        if (newChamp.t2.isAtLeastAsGood(oldChamp.t3))         itr.remove();
        if (oldChamp.t3.isBetter(newChamp.t2))         itr2.remove();
      }
    }
    for (    Pair<Genotype<T>,Score<T>> champion : newChampsList) {
      hall.add(new Triple<Integer,Genotype<T>,Score<T>>(generation,champion.t1,champion.t2));
    }
  }
 else {
    for (    Pair<Genotype<T>,Score<T>> champion : newChampsList) {
      hall.add(new Triple<Integer,Genotype<T>,Score<T>>(generation,champion.t1,champion.t2));
    }
  }
}
Program: 39146
Project: 39146
Buggy source:
@Override protected void reset(){
  for (int i=0; i < animations.length; i++) {
synchronized (animations[i]) {
      animations[i].clear();
    }
  }
  super.reset();
}

Fixed version (ground truth):
@Override protected void reset(){
  super.reset();
  for (int i=0; i < animations.length; i++) {
synchronized (animations[i]) {
      animations[i].clear();
    }
  }
}
Program: 39148
Project: 39148
Buggy source:
@Override protected void save(int i){
  BufferedImage[] toSave=getAnimationImages(scores.get(i).individual.getPhenotype(),0,Parameters.parameters.integerParameter("String_Node_Str"),true);
  JFileChooser chooser=new JFileChooser();
  chooser.setApproveButtonText("String_Node_Str");
  FileNameExtensionFilter filter=new FileNameExtensionFilter("String_Node_Str","String_Node_Str");
  chooser.setFileFilter(filter);
  int returnVal=chooser.showOpenDialog(frame);
  if (returnVal == JFileChooser.APPROVE_OPTION) {
    System.out.println("String_Node_Str" + chooser.getSelectedFile().getName());
    try {
      AnimationUtil.createGif(toSave,Parameters.parameters.integerParameter("String_Node_Str"),chooser.getSelectedFile().getName() + "String_Node_Str");
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
    System.out.println("String_Node_Str" + chooser.getSelectedFile().getName() + "String_Node_Str");
  }
 else {
    System.out.println("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override protected void save(int i){
  BufferedImage[] toSave=getAnimationImages(scores.get(i).individual.getPhenotype(),0,Parameters.parameters.integerParameter("String_Node_Str"),true);
  JFileChooser chooser=new JFileChooser();
  chooser.setApproveButtonText("String_Node_Str");
  FileNameExtensionFilter filter=new FileNameExtensionFilter("String_Node_Str","String_Node_Str");
  chooser.setFileFilter(filter);
  int returnVal=chooser.showOpenDialog(frame);
  if (returnVal == JFileChooser.APPROVE_OPTION) {
    System.out.println("String_Node_Str" + chooser.getSelectedFile().getName());
    try {
      AnimationUtil.createGif(toSave,Parameters.parameters.integerParameter("String_Node_Str"),chooser.getCurrentDirectory() + "String_Node_Str" + chooser.getSelectedFile().getName()+ "String_Node_Str");
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
    System.out.println("String_Node_Str" + chooser.getSelectedFile().getName() + "String_Node_Str");
  }
 else {
    System.out.println("String_Node_Str");
  }
}
Program: 39150
Project: 39150
Buggy source:
@Override protected void reset(){
  super.reset();
  for (int i=0; i < animations.length; i++) {
synchronized (animations[i]) {
      animations[i].clear();
    }
  }
}

Fixed version (ground truth):
@Override protected void reset(){
  for (int i=0; i < animations.length; i++) {
synchronized (animations[i]) {
      animations[i].clear();
    }
  }
  super.reset();
}
Program: 39151
Project: 39151
Buggy source:
private double distance(Unit currentUnit,int enemyBaseLocation){
  int baseY=enemyBaseLocation % pgs.getWidth();
  int baseX=enemyBaseLocation / pgs.getWidth();
  double distance=Math.sqrt(Math.abs((currentUnit.getX() - baseX) + (currentUnit.getY() - baseY)));
  System.out.println("String_Node_Str" + currentUnit.getX() + "String_Node_Str"+ currentUnit.getY()+ "String_Node_Str"+ baseX+ "String_Node_Str"+ baseY+ "String_Node_Str"+ distance);
  return distance;
}

Fixed version (ground truth):
private double distance(Unit currentUnit,int enemyBaseLocation){
  int baseY=enemyBaseLocation % pgs.getWidth();
  int baseX=enemyBaseLocation / pgs.getWidth();
  return Math.sqrt(Math.abs((currentUnit.getX() - baseX) * (currentUnit.getX() - baseX) + (currentUnit.getY() - baseY) * (currentUnit.getY() - baseY)));
}
Program: 39153
Project: 39153
Buggy source:
@Override protected void additionalButtonClickAction(int scoreIndex,Genotype<T> individual){
  if (arrayPlayer != null) {
    arrayPlayer.stopPlayback();
  }
  if (chosen[scoreIndex]) {
    Network phenotype=individual.getPhenotype();
    double[] amplitude=SoundFromCPPNUtil.amplitudeRemixer(phenotype,WAVDoubleArray,Parameters.parameters.integerParameter("String_Node_Str"),playBackRate,inputMultipliers);
    arrayPlayer=PlayDoubleArray.playDoubleArray(format,amplitude);
  }
}

Fixed version (ground truth):
@Override protected void additionalButtonClickAction(int scoreIndex,Genotype<T> individual){
  if (arrayPlayer != null) {
    arrayPlayer.stopPlayback();
  }
  if (chosen[scoreIndex]) {
    Network phenotype=individual.getPhenotype();
    double[] amplitude=SoundFromCPPNUtil.amplitudeRemixer(phenotype,WAVDoubleArray,Parameters.parameters.integerParameter("String_Node_Str"),FREQUENCY_DEFAULT,inputMultipliers);
    arrayPlayer=PlayDoubleArray.playDoubleArray(amplitude);
  }
}
Program: 39154
Project: 39154
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,inputMultipliers,chooser.getSelectedFile().getName() + "String_Node_Str",format);
}

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"),FREQUENCY_DEFAULT,inputMultipliers,chooser.getSelectedFile().getName() + "String_Node_Str",format);
}
Program: 39155
Project: 39155
Buggy source:
@Override protected BufferedImage getButtonImage(Network phenotype,int width,int height,double[] inputMultipliers){
  double[] amplitude=SoundFromCPPNUtil.amplitudeRemixer(phenotype,WAVDoubleArray,Parameters.parameters.integerParameter("String_Node_Str"),playBackRate,inputMultipliers);
  BufferedImage wavePlotImage=GraphicsUtil.wavePlotFromDoubleArray(amplitude,height,width);
  return wavePlotImage;
}

Fixed version (ground truth):
@Override protected BufferedImage getButtonImage(Network phenotype,int width,int height,double[] inputMultipliers){
  double[] amplitude=SoundFromCPPNUtil.amplitudeRemixer(phenotype,WAVDoubleArray,Parameters.parameters.integerParameter("String_Node_Str"),FREQUENCY_DEFAULT,inputMultipliers);
  BufferedImage wavePlotImage=GraphicsUtil.wavePlotFromDoubleArray(amplitude,height,width);
  return wavePlotImage;
}
Program: 39156
Project: 39156
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
 * @param format 
 */
public static void saveRemixedFileFromCPPN(Network cppn,double[] inputWAV,int length,double sampleRate,double[] inputMultipliers,String fileName,AudioFormat format){
  double[] generatedSound=amplitudeRemixer(cppn,inputWAV,length,sampleRate,inputMultipliers);
  SaveFromArray.saveFileFromDoubleArray(fileName,generatedSound,format);
}

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 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,double[] inputMultipliers,String fileName,AudioFormat format){
  double[] generatedSound=amplitudeRemixer(cppn,inputWAV,length,frequency,inputMultipliers);
  SaveFromArray.saveFileFromDoubleArray(fileName,generatedSound,format);
}