chiark / gitweb /
Special case in dead-end checking which prevents the solver falling
authorSimon Tatham <anakin@pobox.com>
Sun, 22 May 2005 11:45:20 +0000 (11:45 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 22 May 2005 11:45:20 +0000 (11:45 +0000)
over on a grid containing a 0 (completely blank) tile. This can't
happen in self-generated grids, but can happen if you type in a grid
from another Net implementation. Previously, the solver would notice
(technically correctly!) that a completely blank tile connects to no
other tiles and thus forms an isolated subgraph, and would therefore
complain that no orientation of that tile could possibly yield a
valid solution...

[originally from svn r5828]

net.c

diff --git a/net.c b/net.c
index b5134a9473ca63ada16690b1f1a3cbe650c29a29..5037c9b2ec83df3e41af839123d52f4d22ee25c7 100644 (file)
--- a/net.c
+++ b/net.c
@@ -657,7 +657,7 @@ static int net_solver(int w, int h, unsigned char *tiles,
                     * dead ends of size 2 and 3 forms a subnetwork
                     * with a total area of 6, not 5.)
                     */
-                   if (deadendtotal+1 < area)
+                   if (deadendtotal > 0 && deadendtotal+1 < area)
                        valid = FALSE;
                } else if (nnondeadends == 1) {
                    /*