| Summary: | The program will remove the invalid start move piece | ||
|---|---|---|---|
| Product: | CS3343 Chinese Checker | Reporter: | yutongmen2-c |
| Component: | Algorithm Component | Assignee: | yutongmen2-c |
| Status: | CONFIRMED --- | ||
| Severity: | normal | CC: | yutongmen2-c, zhengyxue3-c |
| Priority: | --- | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: | The image shows a piece disappeared after an invalid input | ||
Previous code:
public void giveTips(){ // API to demo in GUI
//...
judge_point.setStatus(0);
ArrayList<Point> result = new ArrayList<>();
result = Judge.find(judge_point, g, 0);
for (Point point : result) {
pArray.add(point);
}
}
After Modification:
public void giveTips(){ // API to demo in GUI
int prev_status = judge_point.getStatus();
judge_point.setStatus(0);
ArrayList<Point> result = new ArrayList<>();
result = Judge.find(judge_point, g, 0);
for (Point point : result) {
pArray.add(point);
}
// set status back
if(result.isEmpty()) judge_point.setStatus(prev_status);
}
|
Created attachment 89 [details] The image shows a piece disappeared after an invalid input The program still removes the start move piece if it is invalid which results in the wrong total pieces number. Steps to reproduce: 1. Start the game. 2. Select a piece that is invalid. Actual outcome: 1. The program prints "Not valid start move, please input again." 2. The selected piece is removed by the program. Expected outcome: 1. The program prints "Not valid start move, please input again." 2. The selected piece is not influenced and the program asks for another valid input.