Program: 40537
Project: 40537
Buggy source:
/** 
 * Updates the GUI based on data read from Map Some child code derived from http://discourse.mapeditor.org/t/loading-tmx-map-and-displaying-with-javafx/1189
 */
private void updateGameGUI(){
  if (_map == null) {
    LOGGER.fatal("String_Node_Str");
    return;
  }
  String overlay=null;
switch (_engine.getGameState()) {
case INACTIVE:
    return;
case WON:
  overlay="String_Node_Str";
break;
case LOST:
overlay="String_Node_Str";
break;
case STALEMATE:
overlay="String_Node_Str";
break;
}
if (overlay != null) {
if (!hasDisplayedResultScreen) {
URL img=getClass().getResource(overlay);
displayResultScreen(img);
}
return;
}
ArrayList<MapLayer> layerList=new ArrayList<>(this._map.getLayers());
redrawCoords=new ArrayList<>();
Collections.reverse(layerList);
identifyDeltas(layerList);
Collections.reverse(layerList);
updateDeltas(layerList);
if (this.userHealth == null) {
this.userHealth=new ProgressBar();
this.opponentHealth=new ProgressBar();
this.opponentHealth.setTranslateX(700);
}
 else {
_imagePane.getChildren().remove(this.userHealth);
_imagePane.getChildren().remove(this.opponentHealth);
}
double userHealth=_engine.game.getPlayer(Game.PLAYER_ID).getHealth();
double opponentHealth=_engine.game.getPlayer(Game.OPPONENT_ID).getHealth();
double max=Game.HEALTH_MAX;
double userRatio=userHealth / max;
this.userHealth.setProgress(userRatio);
double opponentRatio=opponentHealth / max;
System.out.println("String_Node_Str" + opponentHealth);
System.out.println("String_Node_Str" + Double.toString(opponentRatio));
this.opponentHealth.setProgress(opponentHealth / max);
_imagePane.getChildren().add(this.opponentHealth);
_imagePane.getChildren().add(this.userHealth);
}

Fixed version (ground truth):
/** 
 * Updates the GUI based on data read from Map Some child code derived from http://discourse.mapeditor.org/t/loading-tmx-map-and-displaying-with-javafx/1189
 */
private void updateGameGUI(){
  if (_map == null) {
    LOGGER.fatal("String_Node_Str");
    return;
  }
  String overlay=null;
switch (_engine.getGameState()) {
case INACTIVE:
    return;
case WON:
  overlay="String_Node_Str";
break;
case LOST:
overlay="String_Node_Str";
break;
case STALEMATE:
overlay="String_Node_Str";
break;
}
if (overlay != null) {
if (!hasDisplayedResultScreen) {
URL img=getClass().getResource(overlay);
displayResultScreen(img);
}
Alert endGame=new Alert(Alert.AlertType.CONFIRMATION,"String_Node_Str",ButtonType.YES,ButtonType.NO);
endGame.initModality(Modality.APPLICATION_MODAL);
endGame.setHeaderText(null);
endGame.setTitle("String_Node_Str");
Optional<ButtonType> result=endGame.showAndWait();
if (result.isPresent()) {
_engine.shutdown(true);
if (result.get().equals(ButtonType.YES)) {
try {
MenuGUI m=new MenuGUI();
_stage.getScene().getWindow().hide();
return;
}
 catch (Exception ex) {
System.exit(1);
}
}
 else {
System.exit(0);
}
}
return;
}
ArrayList<MapLayer> layerList=new ArrayList<>(this._map.getLayers());
redrawCoords=new ArrayList<>();
Collections.reverse(layerList);
identifyDeltas(layerList);
Collections.reverse(layerList);
updateDeltas(layerList);
if (this.userHealth == null) {
this.userHealth=new ProgressBar();
this.opponentHealth=new ProgressBar();
this.opponentHealth.setTranslateX(700);
}
 else {
_imagePane.getChildren().remove(this.userHealth);
_imagePane.getChildren().remove(this.opponentHealth);
}
double userHealth=_engine.game.getPlayer(Game.PLAYER_ID).getHealth();
double opponentHealth=_engine.game.getPlayer(Game.OPPONENT_ID).getHealth();
double max=Game.HEALTH_MAX;
double userRatio=userHealth / max;
this.userHealth.setProgress(userRatio);
double opponentRatio=opponentHealth / max;
System.out.println("String_Node_Str" + opponentHealth);
System.out.println("String_Node_Str" + Double.toString(opponentRatio));
this.opponentHealth.setProgress(opponentHealth / max);
_imagePane.getChildren().add(this.opponentHealth);
_imagePane.getChildren().add(this.userHealth);
}