Gary Wong points out a couple of minor errors in the setting of
[sgt/puzzles] / unequal.c
index 74eba79..8006ea1 100644 (file)
--- a/unequal.c
+++ b/unequal.c
 #include "puzzles.h"
 #include "latin.h" /* contains typedef for digit */
 
+static void assert_f(p)
+{
+    assert(p);
+}
+
 /* ----------------------------------------------------------
  * Constant and structure definitions
  */
@@ -631,7 +636,7 @@ static int solver_grid(digit *grid, int o, int maxdiff, void *ctx)
     game_solver *solver;
     struct latin_solver *lsolver;
     struct latin_solver_scratch *scratch;
-    int ret, diff = DIFF_LATIN, extreme;
+    int ret, diff = DIFF_LATIN;
 
     assert(maxdiff <= DIFF_RECURSIVE);
 
@@ -668,18 +673,28 @@ cont:
         if (maxdiff <= DIFF_EASY)
             break;
 
-        ret = latin_solver_diff_set(lsolver, scratch, &extreme);
+        /* Row- and column-wise set elimination */
+        ret = latin_solver_diff_set(lsolver, scratch, 0);
         if (ret < 0) {
             diff = DIFF_IMPOSSIBLE;
             goto got_result;
         } else if (ret > 0) {
-            diff = max(diff, extreme ? DIFF_EXTREME : DIFF_SET);
+            diff = max(diff, DIFF_SET);
             goto cont;
         }
 
         if (maxdiff <= DIFF_SET)
             break;
 
+        ret = latin_solver_diff_set(lsolver, scratch, 1);
+        if (ret < 0) {
+            diff = DIFF_IMPOSSIBLE;
+            goto got_result;
+        } else if (ret > 0) {
+            diff = max(diff, DIFF_EXTREME);
+            goto cont;
+        }
+
         /*
          * Forcing chains.
          */
@@ -961,7 +976,7 @@ static void game_strip(game_state *new, int *scratch, digit *latin,
         gg_solved++;
         if (solver_state(copy, difficulty) != 1) {
             /* put clue back, we can't solve without it. */
-            assert(gg_place_clue(new, scratch[i], latin, 0) == 1);
+            assert_f(gg_place_clue(new, scratch[i], latin, 0) == 1);
         } else {
 #ifdef STANDALONE_SOLVER
             if (solver_show_working)
@@ -1345,7 +1360,7 @@ static game_state *execute_move(game_state *state, char *move)
             p++;
         }
         if (*p) goto badmove;
-        assert(check_complete(ret->nums, ret, 1) > 0);
+       assert_f(check_complete(ret->nums, ret, 1) > 0);
         return ret;
     } else if (move[0] == 'H') {
         return solver_hint(state, NULL, DIFF_EASY, DIFF_EASY);
@@ -1738,7 +1753,7 @@ const struct game thegame = {
     TRUE, FALSE, game_print_size, game_print,
     FALSE,                            /* wants_statusbar */
     FALSE, game_timing_state,
-    0,                                /* flags */
+    REQUIRE_RBUTTON | REQUIRE_NUMPAD,  /* flags */
 };
 
 /* ----------------------------------------------------------------------