Created attachment 47 [details] This is the final mentioned class in the error prompt. Summary: When the player played several swaps, and won the game, the eclipse would prompt "Exception in thread "main" java.lang.NullPointerException". Steps to reproduce: 1. Run the program; 2. Input your swaps and finally win the game. Actual Results: Exception in thread "main" java.lang.NullPointerException: Cannot invoke "game.GameController.terminateGame()" because "this.theGC" is null at game.ScoreBoardHandler.update(ScoreBoardHandler.java:36) at game.GameController.updateScore(GameController.java:38) at game.Map.destroyDestoyable(Map.java:198) at game.Map.destroyRoutine(Map.java:346) at game.Map.swapItem(Map.java:312) at game.MapController.swapItems(MapController.java:53) at game.GameController.swapItems(GameController.java:42) at game.UserInputHandler.handleUserInput(UserInputHandler.java:79) at game.UserInputHandler.getUserInput(UserInputHandler.java:44) at game.GameController.startGame(GameController.java:31) at game.Main.main(Main.java:9) Remaining Steps: 15; Score: 52 Congratulations! Expected Results: Remaining Steps: 15; Score: 52 Congratulations!
(In reply to jli262-c from comment #0) > Created attachment 47 [details] > This is the final mentioned class in the error prompt. > > Summary: > When the player played several swaps, and won the game, the eclipse would > prompt "Exception in thread "main" java.lang.NullPointerException". > > Steps to reproduce: > 1. Run the program; > 2. Input your swaps and finally win the game. > > Actual Results: > Exception in thread "main" java.lang.NullPointerException: Cannot invoke > "game.GameController.terminateGame()" because "this.theGC" is null > at game.ScoreBoardHandler.update(ScoreBoardHandler.java:36) > at game.GameController.updateScore(GameController.java:38) > at game.Map.destroyDestoyable(Map.java:198) > at game.Map.destroyRoutine(Map.java:346) > at game.Map.swapItem(Map.java:312) > at game.MapController.swapItems(MapController.java:53) > at game.GameController.swapItems(GameController.java:42) > at game.UserInputHandler.handleUserInput(UserInputHandler.java:79) > at game.UserInputHandler.getUserInput(UserInputHandler.java:44) > at game.GameController.startGame(GameController.java:31) > at game.Main.main(Main.java:9) > Remaining Steps: 15; Score: 52 > Congratulations! > > Expected Results: > Remaining Steps: 15; Score: 52 > Congratulations! No initialization for the object of GameController class. Add "theGC = GameController.getInstance" and everything is OK.