From: simon Date: Sun, 22 May 2005 12:14:39 +0000 (+0000) Subject: Another tweak to the solver to make it handle blank tiles correctly. X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/commitdiff_plain/3af1c093fd7935f25cd17e550cff0afac3cae863 Another tweak to the solver to make it handle blank tiles correctly. The previous checkin stopped it choking on them, but it didn't actually manage to _deduce_ that all the edges bordering them had to be closed. Now it does better. git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5829 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/net.c b/net.c index 5037c9b..76323ca 100644 --- a/net.c +++ b/net.c @@ -694,7 +694,6 @@ static int net_solver(int w, int h, unsigned char *tiles, assert(j > 0); /* we can't lose _all_ possibilities! */ if (j < i) { - int a, o; done_something = TRUE; /* @@ -703,12 +702,16 @@ static int net_solver(int w, int h, unsigned char *tiles, */ while (j < 4) tilestate[(y*w+x) * 4 + j++] = 255; + } - /* - * Now go through them again and see if we've - * deduced anything new about any edges. - */ + /* + * Now go through the tile orientations again and see + * if we've deduced anything new about any edges. + */ + { + int a, o; a = 0xF; o = 0; + for (i = 0; i < 4 && tilestate[(y*w+x) * 4 + i] != 255; i++) { a &= tilestate[(y*w+x) * 4 + i]; o |= tilestate[(y*w+x) * 4 + i];