shithub: puzzles

Download patch

ref: 6776b0afba6b4b3f8efd76a8425831b3d8a59a77
parent: 572a7469373a4e3073043001dc9e61289259316d
author: Simon Tatham <anakin@pobox.com>
date: Sat Jan 9 12:21:36 EST 2010

Oops. Uncomment the difficulty exceptions! (Also add another
constraint in validate_params.)

[originally from svn r8824]

--- a/unfinished/group.c
+++ b/unfinished/group.c
@@ -242,6 +242,17 @@
 	 */
 	return "Trivial puzzles must have an identity";
     }
+    if (!params->id && params->w == 3) {
+	/*
+	 * We can't have a 3x3 puzzle without an identity either,
+	 * because 3x3 puzzles can't ever be harder than Trivial
+	 * (there are no 3x3 latin squares which aren't also valid
+	 * group tables, so enabling group-based deductions doesn't
+	 * rule out any possible solutions) and - as above - Trivial
+	 * puzzles can't not have an identity.
+	 */
+	return "3x3 puzzles must have an identity";
+    }
     return NULL;
 }
 
@@ -602,7 +613,6 @@
      * _out_, so as to detect exceptions that should be removed as
      * well as those which should be added.
      */
-#if 0
     if (w < 5 && diff == DIFF_UNREASONABLE)
 	diff--;
     if ((w < 5 || ((w == 6 || w == 8) && params->id)) && diff == DIFF_EXTREME)
@@ -611,7 +621,6 @@
 	diff--;
     if ((w < 4 || (w == 4 && params->id)) && diff == DIFF_NORMAL)
 	diff--;
-#endif
 
     grid = snewn(a, digit);
     soln = snewn(a, digit);