|Enter a Puzzle Code||X|
Local storage is disabled in this browser.
Settings revert to defaults when a puzzle is loaded.
Click or right-click a setting's label to scroll its value.
Right-click a setting's control to set it to its default. Hide
Move the window to the left or right to immediately see any changes to the appearance of the board.
With the exception of Zoom Board, keystrokes will not execute commands or change settings. Keystrokes will still be processed by the browser.Click the timer to pause/resume.
The position in the history can be used to identify positions in a puzzle. This setting can also be toggled by right-clicking the Toggle Bookmark button.
User moves or solver moves will be drawn in a color other than black. Highlight info is included in the history.
X's drawn by undo or redo will be animated. All x's drawn by go to previous or next bookmark, or by the solver in some cases, will be animated if only x's are drawn.
Animation will be used when the 'Save Puzzle' or 'Load Puzzle' button is clicked.
If the solver mode is One Move, this setting is ignored and only non-trivial x's are added (this doesn't work perfectly; trivial x's are sometimes added). If the Trivial option is selected, the solver writes no lines; it's mainly intended for use with auto-solve and the grid display.
Whenever the solver executes, a bookmark is added before the first move it makes and after the last move it makes. Use this setting to add a bookmark before every move (when the solver mode is Manual or Auto). (A 'move' can consist of multiple lines and/or x's.)
Except for 'Assume Only One Solution', the remaining settings in this section will be ignored and considered on, except those with a value of 'Never'. When the Solve button is Shift-Right-clicked, the remaining settings are ignored and considered on regardless of their values.
If 'Assume Only One Solution' is on, deductions will be made based on the puzzle having only one solution. (,*)
All puzzles generated at this site are guaranteed to have only one solution. That is the norm. Turn this setting off if a puzzle (generated somewhere else) is not guaranteed to have only one solution. This will prevent the 'Solve based on Only One Solution' logic from being used in all cases. If that logic is used on a puzzle that has multiple solutions, it's likely that the solver will produce errors. (,*)
Solve horizontally or vertically adjacent threes (*) and diagonally adjacent threes (*). The former will also be solved if 'Use Patterns' is on. The latter will also be solved if Extended Logic is on.
If 'Use Patterns' is on, this setting is ignored and extended logic is used. With 'Solve Loops' on and this setting off, the solver completely solves all Easy and Normal puzzles of any size, but only about 2% of Hard 10x10's. With this setting on, that number jumps to 90%. Therefore, with 'Solve Loops' and this setting on, clicking 'New' with auto-solve on will display a solved puzzle 90% of the time. The 'Skip Puzzles' setting can be used to skip over the solved puzzles. (With the solver at full strength, the solve rate for Hard 10x10's is above 99%.)
The size of click areas for lines and x's will be increased. The size of shades will not be affected. This setting is ignored if the Shade Size is Small.
The size of the click areas for lines and x's will be the same for Large and Max sizes.
Whenever the board is changed by a mouse click or drag, and no position is locked, and the (primary) solver hasn't solved the puzzle, it will try to solve it in the background. If it succeeds, the Check button will flash green, and its icon will be replaced with the clear (unfilled) checkmark. That the solver could solve the puzzle means that 1) no mistake has been made up to that point, and 2) from that point on, it will always be possible to get a move by (shift-)right-clicking the Solve button unless a subsequent mistake is made. If one or more positions are locked, the solver will try to solve the puzzle when all positions are unlocked.
When a puzzle loads, if it can't be solved by the primary solver, and there is no history containing the solution, the puzzle will be solved by the SAT solver. When this happens, the icon of the Check button will be filled with a light gray. The primary solver will still try to solve the puzzle after user input to able to indicate #2 above. ()
When the page loads without a puzzle code in the URL, and the saved puzzle dimensions are large, a message will be displayed. Generating large puzzles can take a long time, and the reason for the delay might not be apparent without the warning.
If 'Skip Puzzles' is on when the page loads, if it's still on, a message will be displayed the first time the 'New' button is clicked.
If Solved/Unsolved is selected, when the 'New' button is clicked, puzzles will be generated - up to the maximum number, and within the maximum time - until one is produced that the solver - operating with current settings or at full strength - can't/can completely solve. This setting is ignored (no puzzles are skipped) for Easy and Normal puzzles unless 'Solve Loops' is off because they will always be solved. If 'Settings' is set to 'Full Strength', solver settings with a value of 'Never' will be considered off; if set to 'Full Strength Absolute', all relevant solver settings will be considered on. The average wait time for a puzzle increases with the size of the puzzle, mostly due to the increased time spent generating the puzzles. To see activity, open the Developers Console (F12) before clicking the 'New' button.
How To Play
The solution to a Slitherlink puzzle is a single closed loop that passes through the indicated number of sides of every numbered square.:
To draw the loop, use left or right mouse clicks, or draw multiple connected lines or x's with a mouse button held down. X's are not part of the solution, but can be used in places that have been determined to be not part of the loop.
NOTE: The browser being used (Safari?) lacks a component (MouseEvent.buttons) that is necessary for drawing with a mouse button held down.
The generator used at this site produces puzzles that have only one solution, a fact that can sometimes be used to make deductions. (This is the norm.)
The Wikipedia Slitherlink page illustrates many basic deductions and patterns, and a couple of advanced strategies. This page contains several, more complex patterns. This page is an introduction to "shading," an elegant solving technique that is supported by this app. There's a tutorial for beginners at this site.
If the Easy 3x3's generated here aren't simple enough to get started, these smaller puzzles may be of use: . These puzzles were generated at this site, which can also generate extremely difficult puzzles pretty quickly.
The SAT Slitherlink Solver is a separate app (same author) that will solve any Slitherlink puzzle that has a solution. Click the link for more information. The SAT solver can be accessed from this app by clicking an item in the 'More Commands' menu or by pressing '9'; in both cases the currenly displayed puzzle will be solved.
The SAT solver has been integrated into this app as a backup to the primary solver. When a puzzle loads, if the primary solver fails to solve the puzzle (in the background), and there is no history containing the solution, the puzzle will be solved by the SAT solver. This means it will always be possible to display the solution to a puzzle and, if the puzzle has only one solution, definitively check for errors. If a puzzle has been solved by the SAT solver, but not the primary solver, the icon of the Check button will be filled with a light gray. The SAT solver will display a message if a puzzle has no solution or more than one solution.
The SAT solver runs in a separate thread (using a web worker), so if it takes a few seconds to solve a very large puzzle there should be no impact on the UI. However, if it causes problems it can be turned off with a setting.
Commands & Settings
Ctrl-Up/Down: Zoom board in/out 1%.
Ctrl-Shift-Up/Down: Zoom board in/out 5%.
T: Toggle display of the timer. Click the timer to pause/resume.
Shift-P: Toggle display of the position in the history (for identifying positions in the puzzle). Right-click the Toggle Bookmark button for the same command.
H: Scroll the 'highlight' setting. Highlight user moves, solver moves, or neither. Highlight info is included in the history.
G: Toggle grid display. (The grid display is modelled on Simon Tatham's.)
Ctrl-Shift-A: Toggle animation of x's in the grid display. X's drawn by undo or redo will be animated. All x's drawn by go to previous or next bookmark, or by the solver in some cases, will be animated if only x's are drawn.
D: Toggle alternate normal display. Right-click the Toggle Grid button for the same command.
Shift-F: Scroll the font. One of the fonts is unavailable with Internet Explorer.
Ctrl-Shift-F: Scroll the darkening value of the current font. Values are 0, 10%, 20% ... 100%. There is a separate setting for each of the three fonts.
Shift-B: Scroll the container background color.
A: Toggle shading. A shade is applied to a square and indicates whether the square is thought to be inside or outside the loop that is the solution to the puzzle. Shades can be used to deduce lines and x's, and other shades (see previous link). They are not included in the history or in locks, and are not considered by the solver or error checker; they will be included in an exported SVG file. Ctrl-A: If there are calculated shades on the board, clear them; otherwise (turn shading on and) calculate the shades for the current position. Right-click the Toggle Shading button for the same command. The shades are calculated based only on existing lines and x's and trivial x's deduced by the solver. The only rule used is two adjacent squares with a line/x between them must have opposite/equal shades. This implies that no deduction can be made unless the shade of one of the two squares is known. At the start of the calculation, the squares with known shades are those shaded by the user, and the two rows and columns of virtual squares beyond the four sides of the board; the latter are outside the loop (there is a setting that determines whether these shades are visible). No error checking is done. If a shade is produced that violates the one rule being used, it implies that there is an error on the board (an incorrect line, x, or shade).
Left/Right, Ctrl-Z/Y: Undo/Redo. Shift-Left/Right: Go to start/end of user or solver set of moves. Right-click the Undo/Redo buttons for the same commands.
Up/Down: Go to previous/next bookmark. The beginning and end of the history function as bookmarks. If Up is pressed and all lines and x's disappear, that's why, just press Down to recover if it wasn't intended. Shift-Up/Down: Go to beginning/end of the history. Right-click the Previous/Next Bookmark buttons for the same commands.
Mousewheel Up/Down: Depending on the Mousewheel setting, either undo/redo or go to previous/next bookmark. If the setting is 'Default', if auto-solve is off, undo/redo, else go to previous/next bookmark. With either button pressed, that behavior is reversed (move the mouse pointer away from the board before pressing the button; this may not work in Safari or IE).
Enter: Add/Remove bookmark at the current position in the history. Ctrl-Enter: Truncate the history at the current position. Ctrl-click the Toggle Bookmark button for the same command.
Y: Play back the history from the current position; if at the end of the history, play back from the start. Ctrl-click the Redo button for the same command. Press any key, or click anywhere, to stop the playback. There are settings for the duration of the playback and the interval between moves; if the former is non-zero, the latter is calculated. Another setting determines whether there is an alert if the puzzle is solved when playback is completed.
V: Execute the solver. Ctrl-V: Execute the solver at full strength (all relevant settings considered on except those with a value of 'Never') for one move. Right-click the Solve button for the same command. Ctrl-Right-click the Solve button to execute the solver at full strength for as many moves as possible (the puzzle will be completely solved if possible). Shift-Right-click the Solve button to execute the solver at absolute full strength (all settings considered on regardless of their values).
Shift-V: Scroll the solver mode. 1 = solve one move when V is pressed, 2 = solve as much as possible when V is pressed, 3 = solve as much as possible automatically whenever the board is changed by a mouse click. 1 is the default.
Ctrl-Shift-V: Scroll the solver mode for locked positions.
Shift-E: Toggle extended logic (off by default). When the 'Use Patterns' setting is on, the 'Extended Logic' setting is ignored and extended logic is used.
Shift-L: Scroll the solving of loops - placing x's in places where a line would complete or cause a loop that is not the solution (on by default).
Shift-R: Scroll the solving of rows and columns - making deductions based on the fact that the solution must pass through each row and column an even number of times (*) (off by default). See 'More about the solver', below, for info.
Shift-N: Scroll the use of patterns (off by default). See 'More about the solver' for info.
Shift-O: Scroll solving based on the puzzle having only one solution (*) (off by default). See Settings and 'More about the solver' for info.
Ctrl-O: Toggle the 'Assume Only One Solution' setting (on by default). See Settings and 'More about the solver' for info.
Shift-X: Scroll the solver's "add x's" mode. 0 = no x's are added to the board; 1 = only non-trivial x's are added; 2 = all x's are added; 3 = only trivial x's - and no lines - are added. 2 is the default. 1 isn't working perfectly, trivial x's are sometimes being added. If the solver mode is One Move, this setting is ignored and only non-trivial x's are added. 3 is mainly intended for use with auto-solve and the grid display.
Ctrl-B: Toggle adding a bookmark before every solver move.
1: Lock the current position.
2: Reset to the last locked position; if at the last locked position, unlock. A position can be locked at any point in the history, and if it's unlocked by a reset, the history will be unchanged.
3: Unlock all locked positions. After the positions are unlocked, the solver will execute if auto-solve is on.
4: Reset to the last locked position and switch the first move. Right-click the Reset button for the same command. If auto-solve is on, the solver will execute immediately after the switch. Because this command might inadvertently result in the loss of moves, it must be enabled with a setting.
Shift-4: Enable/disable Reset And Switch (off by default).
S: Save current puzzle to local storage in its current state. Right-click the 'Save' button, or choose 'Browse saved puzzles' from the 'More Commands' menu, to load or remove saved puzzles. Click 'Export' for a set of links to all, or selected, saved puzzles including histories. Click 'Import' to import puzzles that were previously exported, or to import puzzles from any block of text that contains puzzle codes. Click the puzzle count to display row numbers. Click the plus sign, then 'Show user-defined codes,' or right-click the plus sign, to open a column of editable cells to the left of the puzzle codes column. The meaning of these codes is defined by the user. Whitespace is not allowed in the codes. A query consisting of a list of (comma) delimited codes, or a regular expression, can be created that, if enabled, can be used by the 'Export' and 'Clear' commands. The format of the query is an optional string of one or more single-character flags followed by a space, followed by the list of codes or regular expression. The default delimiter for a list of codes is a comma. Any non-whitespace, non-alphanumeric character, except a minus sign, can be used; include the character in the flags. By default, the query selects all puzzles with codes that are in the list or that match the regular expression; include a minus sign in the flags to reverse that. By default, the query is case-sensitive; include 'i' in the flags to make it case-insensitive. Include 's' in the flags to assign special meanings to these characters in a list of codes: #) any digit; @) any letter; ?) any character; *) any number of characters including none. To use any of these characters as a literal with the 's' flag, precede it with a backslash. Include 'r' in the flags to indicate a regular expression. Whitespace is not allowed in a list of codes; it's stripped from a regular expression. To match puzzles that have no user-defined code, begin or end the list of codes with the delimiter. The query will not be used when it's not visible.
Shift-S: Remove current puzzle from storage (if previously saved).
L: Load current puzzle (if previously saved). When a puzzle is drawn it will be loaded automatically if previously saved, unless the url contains a history. A puzzle is identified by its 'puzzle code', which is always included in the url (see Notes, below). Right-click the Load button to load the puzzle immediately below the current one in the 'Browse saved puzzles' list. If the current puzzle hasn't been saved, the most recently saved puzzle is loaded (the first in the list).
0: Clear the board. The history is also cleared.
Shift-0: Show the solution if it's known. The history and locked positions will be discarded, so save the puzzle first if that's not wanted.
9: Solve the puzzle with ths SAT Slitherlink Solver. Depending on the browser, the solver might open in a new window, or maybe not at all. Use the 'More Commands' menu to reliably open the SAT solver in a new tab.
Spacebar: Search the puzzle for errors. If there is only one solution and the solution is known, the puzzle background will flash green or red, otherwise it will flash yellow or red. With Ctrl-Spacebar (or Right-click the Check button), the first search is for errors that can be determined without knowing the solution; the first such error found will blink. Then, if there is only one solution and the solution is known, the first error added to the board will blink and remain highlighted. The main reason for the first search is that it's sometimes possible to draw a single loop that passes through the indicated number of sides of every numbered square – except one. And on large boards, that one square can be hard to find. (Here are two examples.) Whether or not the solution is known is indicated by the Check button. If the solution isn't known, the checkmark icon will be noticeably smaller than the other icons.
UPDATE: The striped checkmark icon indicates that the primary solver couldn't solve the puzzle, and the puzzle loaded with a history that contained the solution. Since the SAT solver solves all puzzles, the small clear icon indicates that the puzzle has no solution or that the SAT solver failed to excecute. If the small icon is filled with light gray, it means the SAT solver is executing.
Ctrl-E: If the 'Check for errors after user input' setting is on (which is not the default), and no position is locked, the puzzle will be searched for errors automatically whenever the board is changed by a mouse click or drag. If one or more positions are locked, the solver will check for errors when all positions are unlocked. If an error is found, it does not necessarily imply that the last user move was an error; for example, the puzzle might have loaded with a history containing an error. Right-click the 'Check' button to see the first error added to the board.
C: Toggle display of connected lines. When on, hover over a line to show all connected lines. This feature can be useful on large puzzles.
P: (Right-click 'New' for the same command. See immediately below for more on the 'New' button.) Prompt for a puzzle code, and draw or solve the puzzle. See the Notes section for the definition of 'puzzle code'. Unless the puzzle is very small, the fastest way to manually enter a puzzle code will be to 1) omit the width and height from the textarea, and 2) enter one row of characters for each puzzle row, using one character for each square, with a minus sign or period for each blank square (e.g., '3---2' instead of '3c2'). If this method is used, 1) only these characters are permitted: "-._a0123", and line feed (carriage return is ignored); 2) if the width is not specified above the textarea, it will be set to the length of the first line; 3) when a character is appended to the last line so that the length of the line becomes equal to the width, a line feed will be appended automatically; 4) if a valid key is held down (after the width is known), the character will repeat only to the end of the line, making it easy to fill the remainder of a line with blanks; 5) the lines will be adjusted when characters are inserted or deleted anywhere in the puzzle code; 6) if the width and height are specified above the textarea, the puzzle code can be entered and submitted using only these keys: "-._a0123" (without pressing Enter or clicking Draw). If the width and height are specified in the textarea, all whitespace is allowed and ignored. If 'Submit on Enter' is set to 'No', Shift-Enter submits the puzzle code. Right-click the 'Draw' button to display a solution immediately. The textarea is vertically resizable, but apparently not in IE 11.
If the 'Quick Paste Puzzle Code' setting is on, right-click 'New' and hold the mouse button down for an instant (> 200 ms) to paste a puzzle code and draw the puzzle. A puzzle code can also be dropped on the 'New' button.
No Key: A few settings, including 'Skip Puzzles', can only be changed in the Settings window. Some commands cannot be executed with a keystroke.
This Slitherlink app features undo and redo with bookmarks, unlimited locked positions, and shading. Puzzles can be saved to local storage with their complete histories, and the saved puzzles can be browsed. Saved puzzles can be exported, and imported on a different machine. A link can be generated that will load the current puzzle in its current state with its complete history, allowing puzzles to be easily shared. A puzzle can be exported, in its current state, to an SVG file (image only, no script), which can be used in most contexts like any other type of image file. Puzzle codes can be entered, and effort was taken to make the manual entry of a puzzle code as efficient as possible.
The main feature is a rudimentary solver that can be executed while the user is solving a puzzle. It can be executed manually, as needed, or set to execute automatically whenever the board is changed by a mouse click or drag. It can be set to execute a single move (the default), or as many moves as possible. It has several settings that determine the types of logic it uses, though it's always possible to execute it at full strength. When a puzzle is drawn, the solver attempts to solve it in the background, and if it succeeds the user can know at any time if and where a mistake has been made. If it doesn't succeed, the puzzle can still be checked for the types of errors that can be determined without knowing the solution.
UPDATE: The SAT Slitherlink Solver has been integrated into this app as a backup to the primary solver. It solves all valid Slitherlink puzzles. See the 'SAT Slitherlink Solver' section for an updated description of what happens when a puzzle loads. See 'Spacebar' in the 'Misc' section of 'Commands and Settings' for updated info on error checking.
The puzzle generator – written for Simon Tatham's 'Loopy' page by Mike Pinna and/or Tatham and made freely available by Tatham – allows the user to select from four levels of difficulty. The solver completely solves all 'Easy' and 'Medium' puzzles, of any size, so beginning players will always be able to check for errors and click for a move when stuck. More advanced players may want to set the solver to execute automatically (on 'Hard' puzzles or puzzles obtained from other sites), to skip over the easier moves and go straight to the more difficult positions.
The solver has two levels of logic: basic and extended. In the extended logic mode (which is not the default), with 'Solve Loops' on, it will completely solve over 90% of Hard 10x10 puzzles, compared to only 2% in the basic mode. In either mode, with 'Solve Loops' on, it completely solves all Easy and Normal puzzles, of any size, so playing with auto-solve will only make sense with Hard or Tricky puzzles. To avoid displaying puzzles that have been completely auto-solved, a setting - 'Skip Puzzles' - can be used to pass over puzzles that can be completely solved with current settings. See the second note in the Notes section for a brief description of how the solver operates. (With the solver at full strength, the solve rate for Hard 10x10's is above 99%.)
When the solver deduces an error (and makes a mess on the board) it implies that, at some point, a mistake has been made by the user. (The mistake can be in a puzzle code that was entered manually.) Before every release, the solver is tested on a batch of 90,000 puzzles, so the possibility that it is making an invalid deduction is virtually zero.
The app was developed on a laptop, and has not been tested on any handheld device.
What is a 'puzzle code'?
A 'puzzle code' is in the form: WxHdD:S, where W and H are integers indicating the width and height of the board (in squares, not points), D is a digit from 0 to 3 indicating the difficulty of the puzzle, and S is a string of characters that indicates where the numbers are placed on the board, from left to right and top to bottom. A lower case letter is used to indicate one or more blank squares: a = 1, b = 2, etc. Some sites require a letter for blank squares following the last number; here it's optional. The two characters indicating difficulty will be recongnized only at this site, and can be omitted.
For example, the code for the following puzzle is 6x4:e3b2e02233b1b.
In addition to Simon Tatham's site, a puzzle code can be entered at this site, which also features a very fine generator and solver. Currently, both sites will ignore the characters indicating difficulty.
A puzzle can also be defined by using a character for each square, with a character other than 0, 1, 2, or 3 for blank squares, and another character for separating rows. In this app, this is referred to as an "expanded puzzle code," and it can be converted to/from a standard puzzle code in the 'Enter a Puzzle Code' window. In this app, the blank square character can be a period, minus sign, underscore, or 'a'. The row separator must be a line feed (press the Enter key).
More about the solver
With its 'basic' and 'extended' logic, the solver only makes deductions that are possible while looking at one point or one square at a time. When it looks at a square, it considers the number of the square (0, 1, 2, 3, or blank), the four sides of the square, and the eight external grid segments intersecting its four corners. For each square, it reads from, and writes to, only these twelve grid segments. The difference between 'basic' and 'extended' logic is that the former reads only lines and x's that have previously been written to the board (by the solver or user), and writes only lines and x's to the board, whereas the 'extended' mode extends the same logic by writing and reading pseudo lines and x's. If 'Use Patterns' is on, the solver also looks at the four neighbors of each square (there is a virtual row/column of blank squares on each side of the board) - the number and the four sides of each neighboring square.
In the four sections that follow, live puzzle boards are used for examples. After clicking on a link, click Next Bookmark or (shift-)right-click the Solve button for the next move. Here, with the mouse pointer positioned over a board - popup or embedded - the corresponding keys are Down-Arrow and 'V' (the solver will be at full strength), but the mousewheel will be most efficient; roll it down to see the next move. In the 'Solve based on Only One Solution' section, executing the solver past the first move may produce errors because the boards have multiple solutions. That logic is turned off in the 'Use Patterns' section, except for one pattern that requires it. Whenever the mouse pointer passes into a board, it will be reset to its initial position.
The solver doesn't use trial and error.
The app is much slower in IE11 & IE10 than in Chrome or Firefox. It's significantly faster in Chrome than Firefox. (Oct 12, 2019)
In Firefox v75, Shift-Right-click on the Solve button displays the context menu. This is a Firefox bug.
In Chrome v71, with the Arial font, numbers are sometimes being drawn much smaller than expected. It's not happening in Firefox. (Jan 20, 2019)
In IE11 & IE10, horizontal and vertical scrollbars appear unnecessarily when outer shades are visible. (Jan 11, 2019)
It seems that the puzzle generator is running extremely slow in MS Edge, making the 'Skip Puzzles' feature practically unusable. (Nov 8, 2018)
During testing, using Chrome, local storage became corrupted such that some saved puzzles could not be deleted. If that happens, clicking here should fix the problem. (Oct 2, 2017)
In the 'Saved Puzzles: Export' window, Select All doesn't work consistently in Chrome. Click anywhere except on a button or link before clicking the Select All button and it will work. Also in Chrome, Ctrl-C isn't copying the selected links to the clipboard; the copy must be done with the context menu (right-click). (Oct 2, 2017)
After switching from the grid display to the normal display, IE (v11.0) does not display x's correctly. This doesn't happen in Chrome, Firefox or Opera. The problem is resolved when the page is reloaded. (Mar 21, 2017)
If the height of a puzzle is large enough to necessitate a vertical scrollbar, Firefox (v50.1.0) will also add an unnecessary horizontal scrollbar, making less of the puzzle visible. This doesn't happen in Chrome, Opera or IE. (Jan 8, 2017)
Bug reports and comments can be mailed to firstname.lastname@example.org.