diff options
| author | Simon Tatham <anakin@pobox.com> | 2005-05-22 12:14:39 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2005-05-22 12:14:39 +0000 |
| commit | ba3247bb927b412f67365264914740f75a35825b (patch) | |
| tree | 689ee3a11c84e183d9fac07e1b33703cb0c2a9cb | |
| parent | 0066cdd62aea5bde96903682e7fbdadfd5fd08d9 (diff) | |
| download | puzzles-ba3247bb927b412f67365264914740f75a35825b.zip puzzles-ba3247bb927b412f67365264914740f75a35825b.tar.gz puzzles-ba3247bb927b412f67365264914740f75a35825b.tar.bz2 puzzles-ba3247bb927b412f67365264914740f75a35825b.tar.xz | |
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.
[originally from svn r5829]
| -rw-r--r-- | net.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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]; |