From: Simon Tatham Date: Sat, 23 Sep 2017 18:17:36 +0000 (+0100) Subject: Pattern: missing special case in the solver. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=sgt-puzzles.git;a=commitdiff_plain;h=b8313181a6104624000e9cc008e8e26b67aeb655 Pattern: missing special case in the solver. We were filling in a row immediately as all-white if it had no clues at all, but weren't filling in a row as all-black if it had a single clue covering the entire row. Now we do both. In particular, this caused the Pattern solver to be unable to take advantage of one of the two kinds of totally obvious clue across the _easy_ dimension of a trivial 1xN puzzle - and a special case of _that_, as a user pointed out, is that the game generator hangs trying to create a 1x1 puzzle, which ought to be the easiest thing in the world! --- diff --git a/pattern.c b/pattern.c index 9a74e55..ece1ed4 100644 --- a/pattern.c +++ b/pattern.c @@ -446,6 +446,8 @@ static int do_row(unsigned char *known, unsigned char *deduced, if (rowlen == 0) { memset(deduced, DOT, len); + } else if (rowlen == 1 && data[0] == len) { + memset(deduced, BLOCK, len); } else { do_recurse(known, deduced, row, minpos_done, maxpos_done, minpos_ok, maxpos_ok, data, len, freespace, 0, 0);