What is Slitherlink?
Slitherlink is a logic puzzle where you draw a single continuous loop on a grid. The goal is to connect dots without crossing or overlapping, creating a loop that adheres to specific rules based on the numbers in some cells.
The loop must satisfy the following rules:
- The loop cannot cross or touch itself.
- Each numbered cell must have exactly that number of sides in the loop.
A valid puzzle consists of a grid of cells with numbers in some of them, such that there is a unique solution.
Playing Slitherlink
If you would like to try out any of the solving techniques below, I have made a mobile-friendly Slitherlink web app that you can use to play with all of the concepts discussed below (including advanced coloring and sectors).
The Puzzles Mobile and KrazyDad interfaces also provide simple coloring tools to help solve puzzles.
Introduction to Solving
If you're new to Slitherlink, the Wikipedia article is a great starting point. There are also excellent resources and guides available online.
It is highly recommended to avoid guessing, and instead to use logical deductions to solve the puzzle. Guessing is great for learning, but makes solving larger puzzles disappointing when you realize you made a mistake!
Marking X's
One common technique is to mark cells where lines cannot go with an "X". This helps to visualize where lines must go.
Basic Patterns
Some of the patterns only apply to puzzles that are larger than the pattern (i.e. they assume that a small loop would not be the solution to the entire puzzle).
Lines and Dots
Since the loop cannot cross itself, this means each dot will have either zero or two lines connected to it.
Borders are X's
For patterns, it is useful to treat the border of the puzzle as if it extended out and was marked with X's. This applies to corners and edges, and is useful for starting a puzzle!
No Loops
Basic Numbers
Lines and X's can sometimes be deduced just from the number of a cell.
Corner Cases
Edge Cases
Annotated Example
Given the patterns above, let's solve a simple puzzle.
Common Patterns
Sectors and Parity
Only One
It is useful to mark sectors (adjacent pairs of potential lines) with a few properties. The most powerful marking says that "exactly one of these will be a line, and the other will be an X". We denote this below by drawing a red curve between the two potential lines.
On square grids, this property also applies across a dot to the opposite sector:
Thus the only-one sector property will propagate across a chain of diagonally-connected 2s (in a square grid)!
This type of parity arises naturally in many common situations:
It is particularly powerful, not just because it can propagate across 2s, but many of the reverse cases directly deduce lines or X's:
Whenever there is a line or an X in a sector with "only one" line, you can immediately mark the opposite!
The only-one sector can solve the following example patterns, but much more:
Not One
A dual to the "only one" sector is the "not one" sector. This is a sector where either both are lines or both are X's. We will mark this with two blue curves between the two potential lines.
Using the above patterns, it follows that any diagonal chain of 2s will propagate the not-one sector property across the entire chain!
Not Two and Not Zero
Similarly, we can mark sectors when we can rule out two lines or zero lines. We will mark not-two with a single dashed orange curve, and not-zero with a double dashed green curve.
Sector Combinations
When rules overlap and you would mark multiple sectors on a single pair of potential lines, you can combine them into more precise states:
- Not-zero (green) and not-one (blue) => both are lines!
- Not-two (orange) and not-one (blue) => both are X's!
- Not-zero (green) and not-two (orange) => only-one (red)
Common Sector Patterns
Parity
The following rules are very powerful when combined. They represent the concept of parity, in general the concept of even/odd.
Most notably, if all but one sector of a square are marked with only-one or not-one, you can deduce the last sector! If you look at any closed region in the puzzle (e.g. a square, but it can be arbitrary), the number of times the final loop will cross it will be even. Every only-one sector is a "crossing" of our square, and every not-one sector is a "non-crossing".
For example, in a square:
- Three only-one sectors => four only-one sectors (last corner is only-one)
- Three not-one sectors => four not-one sectors (last corner is not-one)
- Two not-one sectors and one only-one sector => two of each (last corner is only-one)
For a concrete case of parity in action, see this reddit thread.
Alternative Representations
The classic form of dots and X's can be harder to use in a few ways:
- The implicit "lines between dots" can be hard to visualize multiple pathways (particularly for coloring/Jordan curve solving).
- The implicit "lines between dots" doesn't work as well for non-square grids (harder to visualize the potential shapes).
- The X's can be awkward on non-square grids (they look weird either rotated or non-rotated).
- Sectors are not as clear with the implicit lines.
For example, the same puzzle is represented below with two methods. The left "arm" of the puzzle (with the 3) needs to connect back to the rest with two line paths. There happens to be a "cut" (marked in red) where there are only two places for lines to pass through (at each endpoint of the red line). Making the possible paths explicit helps identify this type of case.
Alternative Tilings
Any planar graph or tiling can be used to make a puzzle.
Each of which has different rules:
However, it is possible to create/compute "general" rules that work across tilings:
Coloring
Since the loop is a Jordan curve, it divides the cells into two regions, one inside and one outside. This can be used to deduce lines and X's, or even to solve directly.
Coloring is where we mark the deduction "this cell will be in the same/opposite region as this other cell".
A common way of solving with coloring is to mark colors just for the inside and outside of the loop.
However, this is less helpful on larger puzzles, where we may be able to deduce coloring information in the middle, and it is far from any inside/outside coloring.
When coloring, conceptually we get pairs of opposing regions (where every cell in the two different regions is of opposite color, and every cell in the same region is of the same color).
To be able to solve with this information, it helps to use a single color hue for each region pair, but picking a lighter color and darker color to indicate the "opposite" regions:
This user interface tries to make colors as clear as possible (where pairs that are close to each other will have different hues).
Additionally:
- Every line will force its adjacent cells to be of opposite colors.
- Every X will force its adjacent cells to be of the same color.
The opposite is also true:
We can work within the coloring system with a few fundamental patterns:
Many of the usual rules carry over, but some useful ones:
Colors and Sectors
Coloring can also directly imply sectors.
Both sectors and colors can propagate or be joined across disparate parts of a puzzle, and thus can be very powerful.
Highlander
Since valid puzzles must have a single unique solution, we can actually apply additional deductions (generally based on which cells are blank). These are called highlander patterns ("there can be only one").
The core idea is that if adding a line or an X would result in a pattern that would always allow two solutions to exist, then that line or X is wrong (since there is a unique solution), and the opposite must be added.
This can be considered to be less pure, since these pattern rules are incorrect if the puzzle has more than one solution, since they are based on the assumption that there is a unique solution. If used on a puzzle with multiple solutions, it can lead to finding no solution! Furthermore, puzzles are logically solvable without using highlander deductions.
However, highlander deductions can be very powerful, and can be used to solve difficult puzzles quickly. Many people rely on it as a key technique.
Patterns like this generally rely on certain cells being "blank" (i.e. not having a number), since that allows for multiple solutions to exist. For highlander patterns, we will mark cells that can have numbers with question marks.
The classic example of a highlander rule is the following:
For example:
Common Highlander Patterns
Here is a sampling of common highlander patterns:
Some of these are pretty hard to believe! Of note: they cannot be combined to make larger "combined" highlander rules, since they need the exact pattern to match. The pattern explorer can actually list out all of the "excluded" solution patterns for each highlander rule (click on it), showing another solution that rules it out.
For example, see analysis for the first highlander case, or analysis for the last highlander case. Note that the "highlander duplicates" are given in groups (usually pairs), showing which solutions are excluded and why.
The most counter-intuitive thing about excluded solutions (that I swear I have verified logically) is that it is possible to exclude solutions based on "duplicate" solutions that are not possible with the current state of X's and lines! The highlander condition applies to the base puzzle (the numbers and grid), so just because you might have deduced some lines and X's doesn't prevent ruling out things using solutions that contradict those deductions.
Loops and Regions
Below is a case (with two representations) where there is a constriction: if certain moves are made, it will split the puzzle into two disconnected regions.
When thinking in terms of lines and X's: The blue loop goes through only two paths that could have lines. The rest have X's. Since the blue loop has lines on the inside and outside, there must be at least 2 lines connecting through it so that the puzzle doesn't split into two disconnected loops. Notably, any closed loop that you can draw must have an even number of lines through it!
When thinking in terms of colors: The blue line goes through only two colors: the outside (white) and another color (marked with purple). If the purple-dashed color turns into the outside (white) color, it would cut off the region in the blue loop from the rest of the puzzle. Therefore the purple color must be the inside color (gray).
These can also be internal, or with arbitrary colors, as seen above. The interior loop needs to be connected to the outside.
The two colors can actually alternate back-and-forth, and be present in multiple locations, like the example above. Here, both purple-dashed regions are the same color, and for similar reasons they must be the "inside" color (gray).
More Patterns
There are many more patterns for Slitherlink. The above are just a few of the most common ones.
I have computed a large number of patterns, and you can browse them in the pattern explorer.
Fundamentally, there are 5 different databases of patterns:
- Edge (no colors/sectors)
- Color (no edges/sectors)
- Edge + Color (no sectors)
- Edge + Sector (no colors)
- Edge + Color + Sector
It also allows filtering by:
- Highlander
- Numbers/red (helpful for finding "starting" patterns that don't need lines/colors)
- Compatible Tiling
Clicking on any pattern will take you to a page that displays more information about it, and shows how the pattern might work in different tilings.
Practice
To learn patterns, I would highly recommend using the interactive app. Generate a puzzle, solve all that you can, and when you get stuck, hit the "hint" button.
It should show you a new pattern that you missed. This is great for learning new patterns!
If you do not understand the pattern, you can click on it to see more details. Try to see if there is a "solution" that breaks the pattern (i.e. satisfies all constraints, and has no loops). This can help you understand why the pattern is valid.
Additionally, please let me know if I can fix or update anything in the app or on this page!