mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
towerssolver: always print solver diagnostics in -v mode.
The branch of the code that claimed the puzzle to be ambiguous was not also re-running the solver with diagnostics enabled, so that if a user tries to use this tool to hand-design a puzzle, they do not get feedback on what the multiple legal solutions actually are.
This commit is contained in:
14
towers.c
14
towers.c
@ -2072,6 +2072,17 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (really_show_working) {
|
||||||
|
/*
|
||||||
|
* Now run the solver again at the last difficulty level we
|
||||||
|
* tried, but this time with diagnostics enabled.
|
||||||
|
*/
|
||||||
|
solver_show_working = really_show_working;
|
||||||
|
memcpy(s->grid, s->clues->immutable, p->w * p->w);
|
||||||
|
ret = solver(p->w, s->clues->clues, s->grid,
|
||||||
|
diff < DIFFCOUNT ? diff : DIFFCOUNT-1);
|
||||||
|
}
|
||||||
|
|
||||||
if (diff == DIFFCOUNT) {
|
if (diff == DIFFCOUNT) {
|
||||||
if (grade)
|
if (grade)
|
||||||
printf("Difficulty rating: ambiguous\n");
|
printf("Difficulty rating: ambiguous\n");
|
||||||
@ -2084,9 +2095,6 @@ int main(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
printf("Difficulty rating: %s\n", towers_diffnames[ret]);
|
printf("Difficulty rating: %s\n", towers_diffnames[ret]);
|
||||||
} else {
|
} else {
|
||||||
solver_show_working = really_show_working;
|
|
||||||
memcpy(s->grid, s->clues->immutable, p->w * p->w);
|
|
||||||
ret = solver(p->w, s->clues->clues, s->grid, diff);
|
|
||||||
if (ret != diff)
|
if (ret != diff)
|
||||||
printf("Puzzle is inconsistent\n");
|
printf("Puzzle is inconsistent\n");
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user