Bug 733

Summary: Game continues after one King is eaten by opponent
Product: CS3343 Group 26 XiangQi Game Reporter: Tracy Puk <tcpuk2-c>
Component: DisplayAssignee: Teresa Fung <chinwfung3-c>
Status: RESOLVED FIXED    
Severity: major    
Priority: ---    
Version: unspecified   
Hardware: All   
OS: All   
Attachments: Game continues after Black King was eaten

Description Tracy Puk 2022-11-25 12:25:35 HKT
Created attachment 133 [details]
Game continues after Black King was eaten

1. Steps to reproduce the bug:
Start the game
Play until one of the king is eaten

2. Expected result:
Game ends and will print out message to notify player that game is ended and announce the winner

3. Actual result:
The game continues and requires user to input next move
Comment 1 Teresa Fung 2022-11-25 12:29:19 HKT
Root cause:
logic error when checking is there 2 kings on the ChessBoard

Solution:
Added variable to store the color of the winner when one of the King is eaten
Then check whether that variable is null to determine whether the game should continue