| Summary: | It's found that a valid move of the minister is determined to be invaild by the program. | ||
|---|---|---|---|
| Product: | CS3343 2020 Group 9_Chinese Chess | Reporter: | Marco <kaipewang2-c> |
| Component: | ChessGame | Assignee: | Marco <kaipewang2-c> |
| Status: | CONFIRMED --- | ||
| Severity: | critical | CC: | guohan2-c, kaipewang2-c, longtduan2-c, yfeng28-c, yinuowang3-c, yujiawang7-c |
| Priority: | High | ||
| Version: | V2.0 | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Attachments: | Source code of the Minister Class. | ||
|
Description
Marco
2020-11-14 13:37:25 HKT
Created attachment 42 [details]
Source code of the Minister Class.
For HAN Guo's reference.
Bug may exist in getPossibleMove() function.
(In reply to Marco from comment #1) > Created attachment 42 [details] > Source code of the Minister Class. > > For HAN Guo's reference. > Bug may exist in getPossibleMove() function. Bugs are found in getPossibleMove() function. Since the boundary of the loop is set wrongly. The code has changed as below int[] possibleX = {curx-2, curx+2}; int[] possibleY = {cury-2, cury+2}; for(int x1: possibleX){ for(int y1: possibleY){ if(checkLegal(x1, y1)) res.add(new ChessPosition(x1, y1)); } } return res; problem solved |