Bug 595

Summary: Eclipse throws an exception after I input second command to PacMan
Product: Group14-Pacman Reporter: Aleksa <ajelaca2-c>
Component: GameAssignee: Aleksa <ajelaca2-c>
Status: RESOLVED FIXED    
Severity: major    
Priority: High    
Version: 0.0.1   
Hardware: PC   
OS: Windows   

Description Aleksa 2021-11-21 01:03:07 HKT
I ran Main.java and started controlling PacMan. I input "RIGHT" and he went "RIGHT". But when I input "UP" I got this output from Eclipse:

Exception in thread "main" java.util.NoSuchElementException
	at java.base/java.util.Scanner.throwFor(Scanner.java:937)
	at java.base/java.util.Scanner.next(Scanner.java:1478)
	at Game.Game.gameTick(Game.java:39)
	at Game.Main.main(Main.java:16)
Comment 1 Aleksa 2021-11-21 01:05:31 HKT
The solution was to move the Scanner from gameTick() in Game.java to Main.java. Constant opening and closing the Scanner causes the problem