shithub: puzzles

Download patch

ref: d95f476d8b61dcbb9dc1c9bc9398cb295096cd2c
parent: c6e0161dd475415316ed66dc82794d68e52f0025
author: Simon Tatham <[email protected]>
date: Sun Apr 8 13:55:59 EDT 2018

Solo: add a missing params constraint for X puzzles.

Michael Quevillon points out that neither 2x1 nor 3x1 Solo can be made
into an X Sudoku puzzle, on the grounds that whatever number goes in
one corner of the grid is ruled out from both ends (and the centre, if
any) of the opposing diagonal, and hence the X constraint can't be
satisfied.

(Also fixed a spurious full stop on a neighbouring line.)

--- a/solo.c
+++ b/solo.c
@@ -510,7 +510,9 @@
     if ((params->c * params->r) > 31)
         return "Unable to support more than 31 distinct symbols in a puzzle";
     if (params->killer && params->c * params->r > 9)
-	return "Killer puzzle dimensions must be smaller than 10.";
+        return "Killer puzzle dimensions must be smaller than 10";
+    if (params->xtype && params->c * params->r < 4)
+        return "X-type puzzle dimensions must be larger than 3";
     return NULL;
 }