Program: 153005
Project: 153005
Buggy source:
private void update(ArrayList<Unit> entities,FlockRulesCalculator flock,Team team){
  int size=entities.size();
  int num_to_update=(int)((size * m_fraction_to_update) + 1);
  if (size == 0) {
    return;
  }
  int last_updated=m_last_updated.get(team);
  if (last_updated > size - 1) {
    last_updated=0;
  }
  int i=last_updated;
  while (num_to_update > 0) {
    Unit entity=entities.get(i);
    if (entity.getType() == UnitType.DEFENDING) {
      m_defensive.update(entity,this,flock);
    }
 else     if (entity.getType() == UnitType.ATTACKING) {
      m_offensive.update(entity,this,flock);
    }
 else     if (entity.getType() == UnitType.UBER) {
      m_offensive.update(entity,this,flock);
    }
    num_to_update--;
    if (i >= size - 1) {
      i=0;
    }
 else {
      i++;
    }
  }
  if (i >= size - 1) {
    m_last_updated.put(team,0);
  }
 else {
    m_last_updated.put(team,i);
  }
  if (m_tester != null) {
    for (int c=0; c < size; c++) {
      Unit entity=entities.get(c);
      float start_x=entity.getX();
      float start_y=entity.getY();
      float heading=entity.getHeading();
      float startheading=heading;
      boolean clear=false;
      int tries=0;
      while (!clear) {
        if (tries > 100) {
          heading=startheading + MathUtils.PI;
          break;
        }
        float s_x=start_x + 3.0f * FloatMath.cos(heading);
        float s_y=start_y + 3.0f * FloatMath.sin(heading);
        float stickoffsetx=6.0f * FloatMath.cos(heading - MathUtils.PI / 2.0f);
        float stickoffsety=6.0f * FloatMath.sin(heading - MathUtils.PI / 2.0f);
        float leftx1=s_x + stickoffsetx;
        float lefty1=s_y + stickoffsety;
        float leftx2=leftx1 + 12.0f * FloatMath.cos(heading + MathUtils.PI / 6.0f);
        float lefty2=lefty1 + 12.0f * FloatMath.sin(heading + MathUtils.PI / 6.0f);
        float rightx1=s_x - stickoffsetx;
        float righty1=s_y - stickoffsety;
        float rightx2=rightx1 + 12.0f * FloatMath.cos(heading - MathUtils.PI / 6.0f);
        float righty2=righty1 + 12.0f * FloatMath.sin(heading - MathUtils.PI / 6.0f);
        Wall result=m_tester.isLineOfSightClear(rightx1,righty1,rightx2,righty2);
        Wall result2=m_tester.isLineOfSightClear(leftx1,lefty1,leftx2,lefty2);
        if (result == null && result2 == null) {
          clear=true;
        }
 else {
          if (result != null) {
            getTurnVector(entity,result,heading);
          }
 else           if (result2 != null) {
            getTurnVector(entity,result2,heading);
          }
          if (m_vec_result.x == 0 && m_vec_result.y == 0) {
            m_vec_result.x=0.01f;
            m_vec_result.y=0.01f;
          }
          float otherangle=MathUtils.getAngle(0,0,m_vec_result.x,m_vec_result.y);
          if (MathUtils.normalizeAngle(otherangle,startheading) - startheading > 0) {
            heading+=.08f;
          }
 else {
            heading-=.08f;
          }
          tries++;
        }
      }
      entity.setVelocity(entity.getSpeed(),heading);
    }
  }
}

Fixed version (ground truth):
private void update(ArrayList<Unit> entities,FlockRulesCalculator flock,Team team){
  int size=entities.size();
  int num_to_update=(int)((size * m_fraction_to_update) + 1);
  if (size == 0) {
    return;
  }
  int last_updated=m_last_updated.get(team);
  if (last_updated > size - 1) {
    last_updated=0;
  }
  int i=last_updated;
  while (num_to_update > 0) {
    Unit entity=entities.get(i);
    if (entity.getType() == UnitType.DEFENDING) {
      m_defensive.update(entity,this,flock);
    }
 else     if (entity.getType() == UnitType.ATTACKING) {
      m_offensive.update(entity,this,flock);
    }
 else     if (entity.getType() == UnitType.UBER) {
      m_offensive.update(entity,this,flock);
    }
    num_to_update--;
    if (i >= size - 1) {
      i=0;
    }
 else {
      i++;
    }
  }
  if (i > size - 1) {
    m_last_updated.put(team,0);
  }
 else {
    m_last_updated.put(team,i);
  }
  if (m_tester != null) {
    for (int c=0; c < size; c++) {
      Unit entity=entities.get(c);
      float start_x=entity.getX();
      float start_y=entity.getY();
      float heading=entity.getHeading();
      float startheading=heading;
      boolean clear=false;
      int tries=0;
      while (!clear) {
        if (tries > 100) {
          heading=startheading + MathUtils.PI;
          break;
        }
        float s_x=start_x + 3.0f * FloatMath.cos(heading);
        float s_y=start_y + 3.0f * FloatMath.sin(heading);
        float stickoffsetx=6.0f * FloatMath.cos(heading - MathUtils.PI / 2.0f);
        float stickoffsety=6.0f * FloatMath.sin(heading - MathUtils.PI / 2.0f);
        float leftx1=s_x + stickoffsetx;
        float lefty1=s_y + stickoffsety;
        float leftx2=leftx1 + 12.0f * FloatMath.cos(heading + MathUtils.PI / 6.0f);
        float lefty2=lefty1 + 12.0f * FloatMath.sin(heading + MathUtils.PI / 6.0f);
        float rightx1=s_x - stickoffsetx;
        float righty1=s_y - stickoffsety;
        float rightx2=rightx1 + 12.0f * FloatMath.cos(heading - MathUtils.PI / 6.0f);
        float righty2=righty1 + 12.0f * FloatMath.sin(heading - MathUtils.PI / 6.0f);
        Wall result=m_tester.isLineOfSightClear(rightx1,righty1,rightx2,righty2);
        Wall result2=m_tester.isLineOfSightClear(leftx1,lefty1,leftx2,lefty2);
        if (result == null && result2 == null) {
          clear=true;
        }
 else {
          if (result != null) {
            getTurnVector(entity,result,heading);
          }
 else           if (result2 != null) {
            getTurnVector(entity,result2,heading);
          }
          if (m_vec_result.x == 0 && m_vec_result.y == 0) {
            m_vec_result.x=0.01f;
            m_vec_result.y=0.01f;
          }
          float otherangle=MathUtils.getAngle(0,0,m_vec_result.x,m_vec_result.y);
          if (MathUtils.normalizeAngle(otherangle,startheading) - startheading > 0) {
            heading+=.08f;
          }
 else {
            heading-=.08f;
          }
          tries++;
        }
      }
      entity.setVelocity(entity.getSpeed(),heading);
    }
  }
}