Following the publication of my book, "Pattern-Based Constraint Satisfaction and Logic Puzzles (Second Edition)" (PBCS2), in which there is a full chapter dedicated to Slitherlink, I'll give here the detailed solution of a few Slitherlink puzzles according to the resolution model developed in the book - if anyone is still interested in Slitherlink (the topic hasn't been active for a long time).
I'll take the examples discussed in the old thread: http://forum.enjoysudoku.com/solving-slitherlink-puzzles-t31264.html, which I opened little after I discovered Slitherlink on some website. What I wrote there is now largely superseded by what's in the book.
And, as my resolution model is now complete, I preferred to open a new thread.
First, a few definitions and notations (details can be found in the book):
Given a mxn grid (m rows and n columns of cells), there are:
- m+1 rows and n columns of possible horizontal lines
- m rows and n+1 columns of possible vertical lines
the horizontal line at the top of cell r3c7 is named Hr3c7
the vertical line at the left of cell r3c7 is named Vr3c7
There are 3 types of "natural" CSP-Variables (associated with straightforward representations of the givens and solution):
- Nrc represents the number of borders of cell (r, c) touching the solution loop
- Hrc represents the upper border of cell (r, c), Hrc = 1 if it touches the solution loop, 0 otherwise
- Vrc represents the left border of cell (r, c), Vrc = 1 if it touches the solution loop, 0 otherwise
Notice that all the resolution rules presented in the literature use only these CSP-Variables (in their own, usually informal, ways).
As always in my approach, there are additional CSP-Variables, with symbols n, e, s, w representing the cardinal directions:
- Prc represents the point at the upper left corner of cell (r, c). Its values can only be o, nw, ne, sw, se, ns, ew (representing which lines going through it do belong to the solution loop, with obvious restrictions for cells at the edges and corners.
- Brc represents the border of cell (r, c). Its values can only be o, n, s, w, e, nw, ne, sw, se, ns, ew, wne, nes, esw, swn (representing which lines of the border do belong to the solution loop), with obvious restrictions for cells at the edges and corners.
Optionally, there is one more type of CSP-Variables:
- Irc represents whether cell (r, c) is inside (Irc = 1) or outside (Irc = 0) the solution loop.
Notice that, with the values allowed for Prc CSP-Variables, the basic fact that a point can only have 0 or 2 lines touching it is automatically taken into account.