Program: 19943
Project: 19943
Buggy source:
/** 
 * K�ynnist�� uuden vihollisaallon asettamalla siihen kuuluvat viholliset aktiivisiksi.
 */
public void startWave(){
  if ((wrapper.player.x < -(Options.scaledScreenWidth / 2) || wrapper.player.x > (Options.scaledScreenWidth / 2)) && (wrapper.player.y < -(Options.scaledScreenHeight / 2) || wrapper.player.y > (Options.scaledScreenHeight / 2))) {
    if (currentWave == AMOUNT_OF_WAVES) {
      currentWave=0;
      int rankTemp;
      for (int index=enemies.size() - 1; index >= 0; --index) {
        if (enemies.get(index).rank <= 4) {
          rankTemp=enemies.get(index).rank;
          enemies.get(index).setStats(enemyStats[rankTemp][0],enemyStats[rankTemp][1],enemyStats[rankTemp][2],enemyStats[rankTemp][3],enemyStats[rankTemp][4],rankTemp + 1);
        }
      }
    }
    for (int i=0; i < AMOUNT_OF_ENEMIES_PER_WAVE; ++i) {
      spawnPointsX[i]=480;
      spawnPointsY[i]=480;
    }
    int temp;
    int tempRandX, tempRandY;
    for (int index=0; index < AMOUNT_OF_ENEMIES_PER_WAVE; ++index) {
      if (waves[currentWave][index] != -1) {
        temp=waves[currentWave][index];
        tempRandX=Utility.getRandom((int)player.x - (Options.scaledScreenWidth * 2),(int)player.x + (Options.scaledScreenHeight * 2));
        if (tempRandX >= player.x - halfOfScreenWidth && tempRandX <= player.x + halfOfScreenWidth) {
          tempRandY=Utility.getRandom((int)player.y - (Options.scaledScreenHeight * 2),(int)player.y + (Options.scaledScreenHeight * 2));
          if (tempRandY >= player.y - halfOfScreenHeight - 50 && tempRandY <= player.y + halfOfScreenHeight + 50) {
            for (int i=0; i < AMOUNT_OF_ENEMIES_PER_WAVE; ++i) {
              if (spawnPointsX[i] == tempRandX && spawnPointsY[i] == tempRandY) {
                --index;
                break;
              }
 else               if (spawnPointsX[i] == 0 && spawnPointsY[i] == 0) {
                spawnPointsX[i]=tempRandX;
                spawnPointsY[i]=tempRandY;
                enemies.get(temp).setActive();
                enemies.get(temp).x=tempRandX;
                enemies.get(temp).y=tempRandY;
                ++enemiesLeft;
                break;
              }
            }
          }
 else {
            --index;
          }
        }
 else {
          --index;
        }
      }
    }
    ++currentWave;
    ++totalWaves;
  }
}

Fixed version (ground truth):
/** 
 * K�ynnist�� uuden vihollisaallon asettamalla siihen kuuluvat viholliset aktiivisiksi.
 */
public void startWave(){
  if ((wrapper.player.x < -(Options.scaledScreenWidth / 2) || wrapper.player.x > (Options.scaledScreenWidth / 2)) && (wrapper.player.y < -(Options.scaledScreenHeight / 2) || wrapper.player.y > (Options.scaledScreenHeight / 2))) {
    if (currentWave == AMOUNT_OF_WAVES) {
      currentWave=0;
      int rankTemp;
      for (int index=enemies.size() - 1; index >= 0; --index) {
        if (enemies.get(index).rank <= 4) {
          rankTemp=enemies.get(index).rank;
          enemies.get(index).setStats(enemyStats[rankTemp][0],enemyStats[rankTemp][1],enemyStats[rankTemp][2],enemyStats[rankTemp][3],enemyStats[rankTemp][4],rankTemp + 1);
        }
      }
    }
    for (int i=0; i < AMOUNT_OF_ENEMIES_PER_WAVE; ++i) {
      spawnPointsX[i]=480;
      spawnPointsY[i]=480;
    }
    int temp;
    int tempRandX, tempRandY;
    for (int index=0; index < AMOUNT_OF_ENEMIES_PER_WAVE; ++index) {
      if (waves[currentWave][index] != -1) {
        temp=waves[currentWave][index];
        tempRandX=Utility.getRandom((int)player.x - (Options.scaledScreenWidth * 3),(int)player.x + (Options.scaledScreenHeight * 3));
        if (tempRandX < player.x - Options.scaledScreenWidth || tempRandX > player.x + Options.scaledScreenWidth) {
          tempRandY=Utility.getRandom((int)player.y - (Options.scaledScreenHeight * 3),(int)player.y + (Options.scaledScreenHeight * 3));
          if (tempRandY < player.y - Options.scaledScreenHeight - 50 || tempRandY > player.y + Options.scaledScreenHeight + 50) {
            for (int i=0; i < AMOUNT_OF_ENEMIES_PER_WAVE; ++i) {
              if (spawnPointsX[i] == tempRandX && spawnPointsY[i] == tempRandY) {
                --index;
                break;
              }
 else               if (spawnPointsX[i] == 480 && spawnPointsY[i] == 480) {
                spawnPointsX[i]=tempRandX;
                spawnPointsY[i]=tempRandY;
                enemies.get(temp).setActive();
                enemies.get(temp).x=tempRandX;
                enemies.get(temp).y=tempRandY;
                ++enemiesLeft;
                break;
              }
            }
          }
 else {
            --index;
          }
        }
 else {
          --index;
        }
      }
    }
    ++currentWave;
    ++totalWaves;
  }
}