# Algebraic Linesweeper

[If you want to dive straight into Algebraic Linesweeper, here’s a printable PDF with rules.]

A friend of mine, Jak Marshall, created a pen-and-paper puzzle game called Linesweeper. Here are the rules:

• Draw a single, closed, continuous loop in the empty cells of the grid which never crosses itself or branches.
• The number clue in a cell indicates how many of the 8 adjacent cells are part of the loop (as in the classic computer game Minesweeper); for instance, a ‘0’ means that none of the adjacent cells are part of the loop.
• The loop may not enter a cell with a number.
• The loop may run horizontally or vertically (not diagonally) between centres of adjacent cells (that is, parallel to the grid lines).
• The loop does not need to pass through all the unoccupied cells.
• Each puzzle should have a unique solution.
Here’s an example, with its solution immediately below:
You can find this example and at least 20 more online Java puzzles at the German puzzle site janko.at. [Edit: Andrea Sabbatini has included Linesweeper (“the looping minesweeper”) into her 56 Logic Game Time Killers puzzle pack free for the iPhone and iPad. Linewsweeper works well on a touch screen.] Cross+A has even included Linesweeper in their commercial puzzle solver.

I think it’s fun and relaxing, and more satisfying to progress and finally connect the loop than fill in the final cells of a Sudoko puzzle. You can also design puzzles that use a bit of simple graph theory: if there is an area that your line visits with only three possible routes in and out, it can only use an even number (two) of these (the loop is in some sense a Eulerian circuit).

Algebraic Linesweeper

I’d like to introduce a variant of Linesweeper that I created. Instead of giving the number clues for a puzzle in a straightforward manner, I only give some letters that stand in for them. To be more specific:
• Each letter corresponds to a unique number between 0 and 8.
• Within a puzzle, different letters must correspond to different numbers.
• Each puzzle should still have a unique solution!
I’ve made a handy one-page printable pdf file of six Algebraic Linesweeper puzzles, with the rules. The result, at first glance seems impossible. To convince you it is, and check that you’ve understood, here’re two tiny practice puzzles:
The “Elementary” puzzle illustrates the point I was making about Eulerian circuits above: you can view the puzzle as a more discrete version of the following diagram inspired by the Bridges of Königsberg.
Here’s the six actual puzzles from the above pdf in an approximate order of difficulty. Obviously, the choice of letters is slightly arbitrary, so I thought I would choose them based on some theme. If I can spell out words, like below, then it gives a convenient title to identify each puzzle:
The next one is a bit of a concept puzzle. Because I want a unique solution, if the board is symmetrical, then so is the solution loop (but that isn’t require to solve it).
Here, I’ve gone for the playing card royalty symbols:
To create the puzzles, I usually start off with a loop, add in some numbers, checking that it is solvable in the traditional sense, then encrypt the number clues with letters. I then see how far I can get to solving it, adding a few extra clues as I go along, then double-check that it is solvable. The Linesweeper clues seem to encode a lot more information. Sometimes, as window dressing, I have a go at permuting the letters used to see if I can create some identifying words.
The loop for following puzzle is meant to be a simple picture, related to the clue. You can use ordinary Linesweeper to encode pictures too, but in either case your artistic creativity is going to stretched by the restrictions of the rules, and the need to make a solvable puzzle with a unique solution.
I sometimes start out with a concept I want to illustrate, say a particular piece of logic needed to solve some small portion, or, in the puzzle below, the use of every number nought to eight at least once.