Bug 733 - Game continues after one King is eaten by opponent
Summary: Game continues after one King is eaten by opponent
Status: RESOLVED FIXED
Alias: None
Product: CS3343 Group 26 XiangQi Game
Classification: Unclassified
Component: Display (show other bugs)
Version: unspecified
Hardware: All All
: --- major
Assignee: Teresa Fung
URL:
Depends on:
Blocks:
 
Reported: 2022-11-25 12:25 HKT by Tracy Puk
Modified: 2022-11-25 12:29 HKT (History)
0 users

See Also:


Attachments
Game continues after Black King was eaten (123.73 KB, image/jpeg)
2022-11-25 12:25 HKT, Tracy Puk
Details

Note You need to log in before you can comment on or make changes to this bug.
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