Program: 39152
Project: 39152
Buggy source:
/** 
 * counts the number of each unit belonging to each player
 * @param gs current game state
 * @return	array containing input information
 * @author alicequint
 */
public double[] gameStateToArray(GameState gs){
  PhysicalGameState pgs=gs.getPhysicalGameState();
  double[] unitsOnBoard=new double[18];
  unitsOnBoard[workerDelta]=0;
  unitsOnBoard[mobileDelta]=0;
  int workerDeltaUpdates=0;
  int mobileDeltaUpdates=0;
  int enemyBaseLocation=-1;
  int friendlyBaseLocation=-1;
  Unit currentUnit;
  int playerAdjustment;
  for (int i=0; i < pgs.getWidth(); i++) {
    for (int j=0; j < pgs.getHeight(); j++) {
      currentUnit=pgs.getUnitAt(i,j);
      if (currentUnit != null) {
        playerAdjustment=(currentUnit.getPlayer() == 0) ? 0 : enemyAdjustment;
        unitsOnBoard[bases + playerAdjustment]++;
        unitsOnBoard[resources + playerAdjustment]+=currentUnit.getResources();
        unitsOnBoard[hp + playerAdjustment]=currentUnit.getHitPoints();
        if (currentUnit.getPlayer() == 1) {
          enemyBaseLocation=Math.max(enemyBaseLocation,(currentUnit.getY() * pgs.getWidth()) + currentUnit.getX());
        }
        if (currentUnit.getPlayer() == 0) {
          friendlyBaseLocation=Math.min(friendlyBaseLocation,(currentUnit.getY() * pgs.getWidth()) + currentUnit.getX());
        }
      }
    }
  }
  for (int i=0; i < pgs.getWidth(); i++) {
    for (int j=0; j < pgs.getHeight(); j++) {
      currentUnit=pgs.getUnitAt(i,j);
      if (currentUnit != null) {
        playerAdjustment=(currentUnit.getPlayer() == 0) ? 0 : enemyAdjustment;
        double currentDistance;
switch (currentUnit.getType().name) {
case "String_Node_Str":
{
            unitsOnBoard[worker + playerAdjustment]++;
            unitsOnBoard[resources + playerAdjustment]+=currentUnit.getResources();
            if (currentUnit.getPlayer() == 0) {
              if (enemyBaseLocation != -1) {
                currentDistance=distance(currentUnit,enemyBaseLocation);
                System.out.println(unitsOnBoard[mobileDelta] + "String_Node_Str" + currentDistance+ "String_Node_Str"+ unitsOnBoard[mobileDelta]+ "String_Node_Str"+ mobileDeltaUpdates);
                unitsOnBoard[mobileDelta]+=(currentDistance - unitsOnBoard[mobileDelta]) / (++mobileDeltaUpdates);
                MiscUtil.waitForReadStringAndEnterKeyPress();
              }
              if (friendlyBaseLocation != -1) {
                currentDistance=distance(currentUnit,enemyBaseLocation);
                unitsOnBoard[workerDelta]+=(currentDistance - unitsOnBoard[workerDelta]) / (++workerDeltaUpdates);
              }
            }
            break;
          }
case "String_Node_Str":
{
          unitsOnBoard[light + playerAdjustment]++;
          if (currentUnit.getPlayer() == 0 && enemyBaseLocation != -1) {
            currentDistance=distance(currentUnit,enemyBaseLocation);
            unitsOnBoard[mobileDelta]+=(currentDistance - unitsOnBoard[mobileDelta]) / (++mobileDeltaUpdates);
          }
          break;
        }
case "String_Node_Str":
{
        unitsOnBoard[heavy + playerAdjustment]++;
        if (currentUnit.getPlayer() == 0 && enemyBaseLocation != -1) {
          currentDistance=distance(currentUnit,enemyBaseLocation);
          unitsOnBoard[mobileDelta]+=(currentDistance - unitsOnBoard[mobileDelta]) / (++mobileDeltaUpdates);
        }
        break;
      }
case "String_Node_Str":
{
      unitsOnBoard[ranged + playerAdjustment]++;
      if (currentUnit.getPlayer() == 0 && enemyBaseLocation != -1) {
        currentDistance=distance(currentUnit,enemyBaseLocation);
        unitsOnBoard[mobileDelta]+=(currentDistance - unitsOnBoard[mobileDelta]) / (++mobileDeltaUpdates);
      }
      break;
    }
case "String_Node_Str":
{
    unitsOnBoard[barracks + playerAdjustment]++;
    unitsOnBoard[hp + playerAdjustment]=currentUnit.getHitPoints();
    break;
  }
default :
break;
}
}
}
}
System.out.println("String_Node_Str" + unitsOnBoard[mobileDelta] + "String_Node_Str"+ unitsOnBoard[workerDelta]);
return unitsOnBoard;
}

Fixed version (ground truth):
/** 
 * counts the number of each unit belonging to each player
 * @param gs current game state
 * @return	array containing input information
 * @author alicequint
 */
public double[] gameStateToArray(GameState gs){
  PhysicalGameState pgs=gs.getPhysicalGameState();
  double[] unitsOnBoard=new double[18];
  unitsOnBoard[workerDelta]=0;
  unitsOnBoard[mobileDelta]=0;
  int workerDeltaUpdates=0;
  int mobileDeltaUpdates=0;
  int enemyBaseLocation=-1;
  int friendlyBaseLocation=-1;
  Unit currentUnit;
  int playerAdjustment;
  for (int i=0; i < pgs.getWidth(); i++) {
    for (int j=0; j < pgs.getHeight(); j++) {
      currentUnit=pgs.getUnitAt(i,j);
      if (currentUnit != null) {
        playerAdjustment=(currentUnit.getPlayer() == 0) ? 0 : enemyAdjustment;
        unitsOnBoard[bases + playerAdjustment]++;
        unitsOnBoard[resources + playerAdjustment]+=currentUnit.getResources();
        unitsOnBoard[hp + playerAdjustment]=currentUnit.getHitPoints();
        if (currentUnit.getPlayer() == 1) {
          enemyBaseLocation=Math.max(enemyBaseLocation,(currentUnit.getY() * pgs.getWidth()) + currentUnit.getX());
        }
        if (currentUnit.getPlayer() == 0) {
          friendlyBaseLocation=Math.min(friendlyBaseLocation,(currentUnit.getY() * pgs.getWidth()) + currentUnit.getX());
        }
      }
    }
  }
  for (int i=0; i < pgs.getWidth(); i++) {
    for (int j=0; j < pgs.getHeight(); j++) {
      currentUnit=pgs.getUnitAt(i,j);
      if (currentUnit != null) {
        playerAdjustment=(currentUnit.getPlayer() == 0) ? 0 : enemyAdjustment;
        double currentDistance;
switch (currentUnit.getType().name) {
case "String_Node_Str":
{
            unitsOnBoard[worker + playerAdjustment]++;
            unitsOnBoard[resources + playerAdjustment]+=currentUnit.getResources();
            if (currentUnit.getPlayer() == 0) {
              if (enemyBaseLocation != -1) {
                currentDistance=distance(currentUnit,enemyBaseLocation);
                unitsOnBoard[mobileDelta]+=(currentDistance - unitsOnBoard[mobileDelta]) / (++mobileDeltaUpdates);
                MiscUtil.waitForReadStringAndEnterKeyPress();
              }
              if (friendlyBaseLocation != -1) {
                currentDistance=distance(currentUnit,enemyBaseLocation);
                unitsOnBoard[workerDelta]+=(currentDistance - unitsOnBoard[workerDelta]) / (++workerDeltaUpdates);
              }
            }
            break;
          }
case "String_Node_Str":
{
          unitsOnBoard[light + playerAdjustment]++;
          if (currentUnit.getPlayer() == 0 && enemyBaseLocation != -1) {
            currentDistance=distance(currentUnit,enemyBaseLocation);
            unitsOnBoard[mobileDelta]+=(currentDistance - unitsOnBoard[mobileDelta]) / (++mobileDeltaUpdates);
          }
          break;
        }
case "String_Node_Str":
{
        unitsOnBoard[heavy + playerAdjustment]++;
        if (currentUnit.getPlayer() == 0 && enemyBaseLocation != -1) {
          currentDistance=distance(currentUnit,enemyBaseLocation);
          unitsOnBoard[mobileDelta]+=(currentDistance - unitsOnBoard[mobileDelta]) / (++mobileDeltaUpdates);
        }
        break;
      }
case "String_Node_Str":
{
      unitsOnBoard[ranged + playerAdjustment]++;
      if (currentUnit.getPlayer() == 0 && enemyBaseLocation != -1) {
        currentDistance=distance(currentUnit,enemyBaseLocation);
        unitsOnBoard[mobileDelta]+=(currentDistance - unitsOnBoard[mobileDelta]) / (++mobileDeltaUpdates);
      }
      break;
    }
case "String_Node_Str":
{
    unitsOnBoard[barracks + playerAdjustment]++;
    unitsOnBoard[hp + playerAdjustment]=currentUnit.getHitPoints();
    break;
  }
default :
break;
}
}
}
}
return unitsOnBoard;
}