mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-22 08:25:45 -07:00
Some minor fixes to the unfinished Pearl solver:
- move critical correctness checks out of diagnostic ifdefs (ahem) - move declarations to before conditionally compiled code (we don't build in C99 mode round here) - tidy up an unsightly blank line while I'm here. [originally from svn r8969]
This commit is contained in:
@ -217,6 +217,7 @@ int pearl_solve(int w, int h, char *clues, char *result)
|
|||||||
* Now repeatedly try to find something we can do.
|
* Now repeatedly try to find something we can do.
|
||||||
*/
|
*/
|
||||||
while (1) {
|
while (1) {
|
||||||
|
int done_something = FALSE;
|
||||||
|
|
||||||
#ifdef SOLVER_DIAGNOSTICS
|
#ifdef SOLVER_DIAGNOSTICS
|
||||||
for (y = 0; y < H; y++) {
|
for (y = 0; y < H; y++) {
|
||||||
@ -226,8 +227,6 @@ int pearl_solve(int w, int h, char *clues, char *result)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int done_something = FALSE;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Go through the square state words, and discard any
|
* Go through the square state words, and discard any
|
||||||
* square state which is inconsistent with known facts
|
* square state which is inconsistent with known facts
|
||||||
@ -267,9 +266,9 @@ int pearl_solve(int w, int h, char *clues, char *result)
|
|||||||
if (!workspace[(2*y+1)*W+(2*x+1)]) {
|
if (!workspace[(2*y+1)*W+(2*x+1)]) {
|
||||||
#ifdef SOLVER_DIAGNOSTICS
|
#ifdef SOLVER_DIAGNOSTICS
|
||||||
printf("edge check at (%d,%d): inconsistency\n", x, y);
|
printf("edge check at (%d,%d): inconsistency\n", x, y);
|
||||||
|
#endif
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,9 +297,9 @@ int pearl_solve(int w, int h, char *clues, char *result)
|
|||||||
if (edgeand & ~edgeor) {
|
if (edgeand & ~edgeor) {
|
||||||
#ifdef SOLVER_DIAGNOSTICS
|
#ifdef SOLVER_DIAGNOSTICS
|
||||||
printf("square check at (%d,%d): inconsistency\n", x, y);
|
printf("square check at (%d,%d): inconsistency\n", x, y);
|
||||||
|
#endif
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (d = 1; d <= 8; d += d) {
|
for (d = 1; d <= 8; d += d) {
|
||||||
@ -385,7 +384,6 @@ int pearl_solve(int w, int h, char *clues, char *result)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case STRAIGHT:
|
case STRAIGHT:
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user