| Summary: | A start move peg's status would change even if the judge function said it to be invalid. | ||
|---|---|---|---|
| Product: | CS3343 Chinese Checker | Reporter: | yutongmen2-c |
| Component: | Algorithm Component | Assignee: | yutongmen2-c |
| Status: | CONFIRMED --- | ||
| Severity: | normal | CC: | yutongmen2-c |
| Priority: | --- | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
yutongmen2-c
2021-11-29 11:57:30 HKT
Previous code:
public void giveTips(){
judge_point.setStatus(0);
ArrayList<Point> result = new ArrayList<>();
result = new Judge().find(judge_point, g, 0);
for (Point point : result) {
pArray.add(point);
}
}
Modified code:
public void giveTips(){
int prev_status = judge_point.getStatus();
judge_point.setStatus(0);
ArrayList<Point> result = new ArrayList<>();
result = new Judge().find(judge_point, g, 0);
for (Point point : result) {
pArray.add(point);
}
if(result.isEmpty()) judge_point.setStatus(prev_status);
}
|