Program: 39229
Project: 39229
Buggy source:
/** 
 * Evaluates a given individual network's Fitness; If the CommonConstants Watch variable is set to "True," runs a visual evaluation, Else runs a non-visual evaluation
 * @param individual Genotype<T> specifying a Network to be evaluated
 * @param num Integer value
 * @return Pair of Double Arrays that show the Fitness of an individual network
 */
@Override public Pair<double[],double[]> oneEval(Genotype<T> individual,int num){
  PinBall p=new PinBall("String_Node_Str" + Parameters.parameters.stringParameter("String_Node_Str"));
  if (CommonConstants.watch) {
    if (view != null) {
      view.dispose();
      view=null;
    }
    view=new PinballViewer(p);
    view.setVisible(true);
    view.setAlwaysOnTop(true);
  }
  Network n=individual.getPhenotype();
  double fitness=0;
  int timeLimit=1000;
  do {
    State s=p.getState();
    double[] sensors=s.getDescriptor();
    double[] outputs=n.process(sensors);
    int action=StatisticsUtilities.argmax(outputs);
    double rew=p.step(action);
    if (view != null) {
      view.repaint();
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
      if (Parameters.parameters.booleanParameter("String_Node_Str")) {
        System.out.print("String_Node_Str");
        MiscUtil.waitForReadStringAndEnterKeyPress();
      }
    }
    fitness+=rew;
    timeLimit--;
  }
 while (!p.episodeEnd() && timeLimit > 0);
  Double distance=p.getBall().getCenter().distanceTo(p.getTarget().getCenter());
  Pair<double[],double[]> evalResults=new Pair<double[],double[]>(new double[]{fitness},new double[0]);
  if (Parameters.parameters.booleanParameter("String_Node_Str")) {
    evalResults=new Pair<double[],double[]>(new double[]{fitness,distance},new double[0]);
  }
 else {
    evalResults=new Pair<double[],double[]>(new double[]{fitness},new double[0]);
  }
  return evalResults;
}

Fixed version (ground truth):
/** 
 * Evaluates a given individual network's Fitness; If the CommonConstants Watch variable is set to "True," runs a visual evaluation, Else runs a non-visual evaluation
 * @param individual Genotype<T> specifying a Network to be evaluated
 * @param num Integer value
 * @return Pair of Double Arrays that show the Fitness of an individual network
 */
@Override public Pair<double[],double[]> oneEval(Genotype<T> individual,int num){
  PinBall p=new PinBall("String_Node_Str" + Parameters.parameters.stringParameter("String_Node_Str"));
  if (CommonConstants.watch) {
    if (view != null) {
      view.dispose();
      view=null;
    }
    view=new PinballViewer(p);
    view.setVisible(true);
    view.setAlwaysOnTop(true);
  }
  Network n=individual.getPhenotype();
  double fitness=0;
  int timeLimit=1000;
  do {
    State s=p.getState();
    double[] sensors=s.getDescriptor();
    double[] outputs=n.process(sensors);
    int action=StatisticsUtilities.argmax(outputs);
    double rew=p.step(action);
    if (view != null) {
      view.repaint();
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
      if (Parameters.parameters.booleanParameter("String_Node_Str")) {
        System.out.print("String_Node_Str");
        MiscUtil.waitForReadStringAndEnterKeyPress();
      }
    }
    fitness+=rew;
    timeLimit--;
  }
 while (!p.episodeEnd() && timeLimit > 0);
  Double distance=p.getBall().getCenter().distanceTo(p.getTarget().getCenter());
  Pair<double[],double[]> evalResults=new Pair<double[],double[]>(new double[]{fitness},new double[0]);
  if (Parameters.parameters.booleanParameter("String_Node_Str")) {
    evalResults=new Pair<double[],double[]>(new double[]{fitness,-distance},new double[0]);
  }
 else {
    evalResults=new Pair<double[],double[]>(new double[]{fitness},new double[0]);
  }
  return evalResults;
}