Fix a bug causing premature defeatism in the Bridges solver. Deducing
[sgt/puzzles] / unfinished / pearl.c
index 41ab998..51b2ed2 100644 (file)
@@ -217,6 +217,7 @@ int pearl_solve(int w, int h, char *clues, char *result)
      * Now repeatedly try to find something we can do.
      */
     while (1) {
+       int done_something = FALSE;
 
 #ifdef SOLVER_DIAGNOSTICS
        for (y = 0; y < H; y++) {
@@ -226,8 +227,6 @@ int pearl_solve(int w, int h, char *clues, char *result)
        }
 #endif
 
-       int done_something = FALSE;
-
        /*
         * Go through the square state words, and discard any
         * 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)]) {
 #ifdef SOLVER_DIAGNOSTICS
                    printf("edge check at (%d,%d): inconsistency\n", x, y);
+#endif
                    ret = 0;
                    goto cleanup;
-#endif
                }
            }
 
@@ -298,9 +297,9 @@ int pearl_solve(int w, int h, char *clues, char *result)
                if (edgeand & ~edgeor) {
 #ifdef SOLVER_DIAGNOSTICS
                    printf("square check at (%d,%d): inconsistency\n", x, y);
+#endif
                    ret = 0;
                    goto cleanup;
-#endif
                }
 
                for (d = 1; d <= 8; d += d) {
@@ -385,7 +384,6 @@ int pearl_solve(int w, int h, char *clues, char *result)
                        }
                    }
 
-
                    break;
                  case STRAIGHT:
                    /*
@@ -1351,6 +1349,11 @@ static float game_flash_length(game_state *oldstate, game_state *newstate,
     return 0.0F;
 }
 
+static int game_status(game_state *state)
+{
+    return 0;
+}
+
 static int game_timing_state(game_state *state, game_ui *ui)
 {
     return TRUE;
@@ -1399,6 +1402,7 @@ const struct game thegame = {
     game_redraw,
     game_anim_length,
     game_flash_length,
+    game_status,
     FALSE, FALSE, game_print_size, game_print,
     FALSE,                            /* wants_statusbar */
     FALSE, game_timing_state,