Bug 559

Summary: Runtime exception occurrs during game initialization
Product: Group14-Pacman Reporter: YANG Tianxia <tianxyang3-c>
Component: GameAssignee: Omar MOUSTAFA <omoustafa2-c>
Status: RESOLVED FIXED    
Severity: major    
Priority: ---    
Version: 0.0.1   
Hardware: PC   
OS: Windows   
Attachments: Proposed bug fix

Description YANG Tianxia 2021-11-13 17:52:43 HKT
During the initialization of the game, the following runtime exception is thrown right after the console prints out the maze.

Expected output:
W W W W W W W W W W W W W W W W W W W W W W W W W W W W W 
W                                                       W 
W   W W W W W W W W W W   W W W   W W W W W W W W W W   W 
W   W W W W W W W W W W   W W W   W W W W W W W W W W   W 
W   W W W W W W W         W W W         W W W W W W W   W 
W               W   W W W W W W W W W   W               W 
W W W W W W W   W   W W W W W W W W W   W   W W W W W W W 
n n n n n n W   W   W W W W W W W W W   W   W n n n n n n 
n n n n n n W                               W n n n n n n 
n n n n n n W   W   W W W W W W W W W   W   W n n n n n n 
n n n W W W W   W   W W W W W W W W W   W   W W W W n n n 
n n n W         W   W W W W W W W W W   W         W n n n 
n n n W   W W W W                       W W W W   W n n n 
n W W W   W W W W   W W W W n W W W W   W W W W   W W W n 
n W                 W n n n n n n n W                 W n 
n W   W W W   W W   W n n n n n n n W   W W   W W W   W n 
n W   W W W   W W   W n n n n n n n W   W W   W W W   W n 
n W       W   W W   W W W W W W W W W   W W   W       W n 
n W W W   W   W W                       W W   W   W W W n 
n n n W   W   W W W W   W W W W W   W W W W   W   W n n n 
W W W W   W   W W W W   W W W W W   W W W W   W   W W W W 
W                       W W W W W                       W 
W W W W   W W W W   W W W W W W W W W   W W W W   W W W W 
n n n W   W W W W   W W W W W W W W W   W W W W   W n n n 
n n n W   W                                   W   W n n n 
n n n W   W   W W W W   W W W W W   W W W W   W   W n n n 
n W W W   W   W W W W   W W W W W   W W W W   W   W W W n 
n W           W W       W W W W W       W W           W n 
n W   W W W   W W   W W W W W W W W W   W W   W W W   W n 
n W   W W W   W W   W W W W W W W W W   W W   W W W   W n 
n W           W W                       W W           W n 
n W W W W W W W W W W W W W W W W W W W W W W W W W W W n 
Type in a command (Up, Down, Left, Right, Reset): 

Actual output:
        [the maze part is the same, omitted]
java.lang.NullPointerException
	at Game.Frightened.addAlgorithm(Frightened.java:15)
	at Game.Ghost.initGhosts(Ghost.java:46)
	at Game.Game.gameInit(Game.java:26)
	at Game.Main.main(Main.java:18)
Maze has already been generated!


Steps to Reproduce: simply run the Main.java as Java Application, and the exception will be thrown.

JVM Clent Information:
eclipse.buildId=4.20.0.I20210611-1600
java.version=11.0.2
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=zh_CN
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product
Comment 1 YANG Tianxia 2021-11-13 18:02:29 HKT
Created attachment 76 [details]
Proposed bug fix

This is my proposed bug fix