Program: 19954
Project: 19954
Buggy source:
/** 
 * Suoritt�� s�ikeen. Android kutsuu t�t� automaattisesti kun GameThread on k�ynnistetty thread-funktiolla (sis�ltyy Thread-luokkaan).
 */
@Override public void run(){
  while (isRunning) {
    if (gameState == GAMESTATE_LOADING_RESOURCES) {
      if (renderer.allLoaded) {
        gameState=GAMESTATE_STORY;
        gameStateTimer=android.os.SystemClock.uptimeMillis();
        initialize();
      }
    }
 else     if (gameState == GAMESTATE_STORY) {
      currentTime=android.os.SystemClock.uptimeMillis();
      if (currentTime - gameStateTimer >= 3000) {
        gameState=GAMESTATE_STARTUP;
        gameStateTimer=currentTime;
      }
    }
 else     if (gameState == GAMESTATE_STARTUP) {
      currentTime=android.os.SystemClock.uptimeMillis();
      if (currentTime - gameStateTimer >= 0) {
        gameState=GAMESTATE_GAME;
      }
    }
    while (gameState == GAMESTATE_GAME) {
      waveStartTime=android.os.SystemClock.uptimeMillis();
      lastMovementUpdate=waveStartTime;
      lastAiUpdateStateOne=waveStartTime;
      lastAiUpdateStateTwo=waveStartTime;
      lastAiUpdateStateThree=waveStartTime;
      lastCooldownUpdate=waveStartTime;
      lastGameModeUpdate=waveStartTime;
      lastCollisionUpdate=waveStartTime;
      lastArmorUpdate=waveStartTime;
      lastBoundCheck=waveStartTime;
      lastGuideArrowUpdate=waveStartTime;
      lastRadarUpdate=waveStartTime;
      lastMessageUpdate=waveStartTime;
      while (isRunning) {
        currentTime=android.os.SystemClock.uptimeMillis();
        if (currentTime - lastBoundCheck >= 1000) {
          lastBoundCheck=currentTime;
          gameMode.checkBounds();
        }
        if (currentTime - lastMovementUpdate >= 10) {
          updateMovement(currentTime);
          updateBackgroundStars();
        }
        if (wrapper.player != null) {
          updateAi(currentTime);
        }
        checkCollisions(currentTime);
        updateEffects();
        updateWeaponCooldowns(currentTime);
        recoverWeaponArmor(currentTime);
        updateGameMode(currentTime);
        updateGuideArrows(currentTime);
        updateRadar(currentTime);
        try {
          Thread.sleep(20);
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Suoritt�� s�ikeen. Android kutsuu t�t� automaattisesti kun GameThread on k�ynnistetty thread-funktiolla (sis�ltyy Thread-luokkaan).
 */
@Override public void run(){
  while (isRunning) {
    if (gameState == GAMESTATE_LOADING_RESOURCES) {
      if (renderer.allLoaded) {
        gameState=GAMESTATE_STORY;
        gameStateTimer=android.os.SystemClock.uptimeMillis();
        initialize();
      }
    }
 else     if (gameState == GAMESTATE_STORY) {
      currentTime=android.os.SystemClock.uptimeMillis();
      if (currentTime - gameStateTimer >= 0) {
        gameState=GAMESTATE_STARTUP;
        gameStateTimer=currentTime;
      }
    }
 else     if (gameState == GAMESTATE_STARTUP) {
      currentTime=android.os.SystemClock.uptimeMillis();
      if (currentTime - gameStateTimer >= 0) {
        gameState=GAMESTATE_GAME;
      }
    }
    while (gameState == GAMESTATE_GAME) {
      waveStartTime=android.os.SystemClock.uptimeMillis();
      lastMovementUpdate=waveStartTime;
      lastAiUpdateStateOne=waveStartTime;
      lastAiUpdateStateTwo=waveStartTime;
      lastAiUpdateStateThree=waveStartTime;
      lastCooldownUpdate=waveStartTime;
      lastGameModeUpdate=waveStartTime;
      lastCollisionUpdate=waveStartTime;
      lastArmorUpdate=waveStartTime;
      lastBoundCheck=waveStartTime;
      lastGuideArrowUpdate=waveStartTime;
      lastRadarUpdate=waveStartTime;
      lastMessageUpdate=waveStartTime;
      while (isRunning) {
        currentTime=android.os.SystemClock.uptimeMillis();
        if (currentTime - lastBoundCheck >= 1000) {
          lastBoundCheck=currentTime;
          gameMode.checkBounds();
        }
        if (currentTime - lastMovementUpdate >= 10) {
          updateMovement(currentTime);
          updateBackgroundStars();
        }
        if (wrapper.player != null) {
          updateAi(currentTime);
        }
        checkCollisions(currentTime);
        updateEffects();
        updateWeaponCooldowns(currentTime);
        recoverWeaponArmor(currentTime);
        updateGameMode(currentTime);
        updateGuideArrows(currentTime);
        updateRadar(currentTime);
        try {
          Thread.sleep(20);
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
      }
    }
  }
}