shithub: puzzles

Download patch

ref: 38ea1599fe0bf995f5c16b3d2995643976387e15
parent: 00e23909f8599686ae8aa975a7f5a443a500516f
author: Simon Tatham <anakin@pobox.com>
date: Thu Oct 19 20:33:54 EDT 2017

Unequal: run check_complete() after a hint move.

A user sent in the game id
  7:0,0L,0,0,0L,0L,1,0U,0U,0D,0UD,0,0,7,0,0D,0,0D,0,0,0,0,0,0,0,0,0,0D,0,0,3,0,0U,0,0,0,0,2,6,0,0U,0,0,0,7,2,0,0U,5L,
starting from which, one press of 'h' will fill in a 2 in the top left
corner and possibilities 345 to its right; if you then fill in 5 there
and press 'h' again, the hint system fills in the whole of an apparent
solution which isn't the one a proper use of the Solve feature would
give you - except that it's not actually a second solution, because
one < clue on the top row is violated. Without this fix, that < failed
to light up red, making the puzzle look ambiguous if you're not paying
enough attention to spot it.

--- a/unequal.c
+++ b/unequal.c
@@ -1566,7 +1566,9 @@
         }
         return ret;
     } else if (move[0] == 'H') {
-        return solver_hint(state, NULL, DIFF_EASY, DIFF_EASY);
+        ret = solver_hint(state, NULL, DIFF_EASY, DIFF_EASY);
+        check_complete(ret->nums, ret, 1);
+        return ret;
     } else if (move[0] == 'F' && sscanf(move+1, "%d,%d,%d", &x, &y, &n) == 3 &&
 	       x >= 0 && x < state->order && y >= 0 && y < state->order) {
 	ret = dup_game(state);