6
$\begingroup$

I would like to solve this Loopy (Cairo) puzzle:

enter image description here

But I would like to do so with as little backtracking as possible. By this I mean that I want to have at most one pending guess at a time; I do not want to make any further guesses if I have already made one that has not yet been disproven. I believe it is possible using some local patterns, but either I have not found enough local patterns to assist me, or it is in actual fact harder to do so than to just guess more and do more backtracking. I did manage to solve this puzzle but it took me a long time to find suitable search paths that only had one pending guess at any time.

To put my question another way, what is the shortest purely logical solution you can come up with to find the solution to this puzzle and prove that it is unique?

Here is one point at which I could not proceed locally:

Loopy (Cairo) puzzle half-completed

I then used 1-guess backtracking to obtain the following (i.e. in each of the 3 places removing those edges would lead to a contradiction):

Loopy (Cairo) puzzle half-completed plus a few more edges

$\endgroup$
6
  • 6
    $\begingroup$ I agree with Bobble. I solved it without much trouble (and no backtracking at all), so it would be best to give us a picture of the point where you think backtracking might be needed. $\endgroup$ Commented Nov 6, 2020 at 17:18
  • 1
    $\begingroup$ @bobble: Thank you for your comment. I forgot that we should not rely on external links. I have updated my question. $\endgroup$
    – user21820
    Commented Nov 7, 2020 at 1:18
  • 1
    $\begingroup$ @JaapScherphuis: I have included the point at which I could not proceed locally, as well as what I did get using backtracking. Thanks! $\endgroup$
    – user21820
    Commented Nov 7, 2020 at 1:18
  • $\begingroup$ @bobble: I know it is unreasonable to ask for a full logical solution with all the steps, but I was hoping that someone could give a rough outline, only highlighting the more difficult local deductions. Because from what Jaap said it seems that all I need is to know a few more local patterns to be able to solve it easily. $\endgroup$
    – user21820
    Commented Nov 7, 2020 at 2:09
  • 4
    $\begingroup$ Something that isn't answer-worthy: it's very important to always mark any lines that can't be used as such by clicking them away. Then you can see which lines are available. You don't appear to have done this. $\endgroup$
    – bobble
    Commented Nov 7, 2020 at 2:25

1 Answer 1

11
$\begingroup$

Okay, so I solved the whole puzzle :) I will use this specific puzzle to showcase several interesting deductions. Each picture will show one deduction I consider non-trivial, and in between pictures I will make trivial deductions. In this post, "trivial" deductions are:

  • if a cell has all its borders spoken for (e.g. a 1 that has one border shaded), I remove all other borders
  • if a cell has only the minimum number of borders left (e.g. a 3 that has 2 borders removed), I mark all other borders as used
  • if a line has only one other line it could extend to, I extend it
  • if a border would create a fork in the loop, I remove it
  • if a border would close the loop, I remove it

Each deduction will have its area circled. Some also have arrows pointing to important lines. If you want to figure out the deductions by yourself, only click on the first spoiler of each pair to see where the deduction will be. In my explanations, a digit refers to a clue number, and a spelled-out number refers to a quantity.

Some terminology that I use here:

  • "sides" and "borders" are used interchangeably to refer to a single clue-cell's borders
  • "walls" and "lines" are generic terms for a confirmed section of loop
  • "corner" is a spot where multiple possible borders meet
  • "naked" sides are those which must be used together for connectivity purposes - for example, any of the outside-border sides

On to the deductions!

Step 1:

step 1

The deduction:

The 4 can only have 1 border unused. That border has to be one of those adjacent to the line coming in from the 3; if both of the adjacent borders are use that creates a fork in the loop. Therefore every border not adjacent to the 3's line must be used

Step 2:

step 2

The deduction:

This is similar to the previous deduction. The 3 has to use one, and only one, of its remaining sides. No matter which side is used, the 3's side will act the same as the all-important size form the previous deduction. Therefore all sides of the 4 which are not adjacent to the 3 must be used.

Step 3:

step 3

The deduction:

Here the same deduction can be used twice. Both of these 2s need to use exactly one of the two remaining sides. Both sides will use the "middle" corner. The line not bordering the 2, but connected to the "middle" corner, must be used to avoid using both remaining borders of the 2.

Step 4:

step 4

The deduction:

This is a similar deduction to the one before. One, and only one, of the 1's remaining sides must be used, so the outside side connecting to the middle "corner" must be used. I've marked it with an arrow for clarity. Since it is used, then we can apply the reverse of this deduction to the 3. One, and only one, of the 3's remaining sides must be used - and the side we colored in must be the outside "corner" connector, since only one outside side can be used. (If both are used, then the 3's sides would create a fork)

Step 5:

step 5

The deductions (two related ones):

There are two "naked" walls on one side of the 3 that must be used together, and then three others. If the "naked" walls aren't used, then a fork is created with the other three walls and the line from the 1. Therefore the "naked" walls are used. Now only one wall more can be used. If the wall that the arrow is pointing to is used, then the line from the 1 cannot be extended. Therefore that wall is not used.

Step 6:

step 6

The deductions (two related ones):

There are two lines leading in to the 2. Extending either will use up one of the 2's allotted sides. That's all the sides that can be used, so the line with an arrow pointing to it cannot be used. Given that that side is not used, the two borders for the neighboring 2 are now "naked" and must be used together. Except they can't be, since one side of that 2 is already used. So neither of those borders can be used.

Step 7:

step 7

The deduction:

The circled 3 has two "naked" sides. If they aren't used, there are only two sides left, which is too few. Therefore the "naked" sides are used.

Step 8:

step 8

The deductions (two related ones):

The left-side circled 1 has two "naked" sides. They can't be used, as two sides is too many for a 1 to use. The right-side circled 1 has a line leading into it. If any of the sides not adjacent to that line are used, then the line has nowhere to extend to. So all of the non-adjacent sides are unused.

Step 9:

step 9

The deductions (two related ones):

The left-side circled 3 has only two ways to use exactly three sides: the top "naked" two and the far-right side, or the the bottom "naked" two and the far-right side. From this it is clear that the far-right side must be used, and the side leading in to both "naked" ones from the left must be use. The right-side circled 4 has a line leading in to the top and the bottom (because at least one of the two remaining sides for the lower 3 must be used). Only one of each border adjacent to those coming-in lines can be used, to prevent a fork in the loop. To use three borders, then, the only non-adjacent side must be used.

Step 10:

step 10

The deduction:

The line leading in to this bottom section (black arrow) must go up at some point to connect to the rest of the loop. To go up, the line that is being pointed to by the red arrow must be used.

For completion, the solution:

solution

In response to comments:

It seems you were asking for a logical solve from your second picture, not your third picture. Below I present such a solve. This time I skip all trivial deductions, as well as deductions that I covered in the above pictures.

Step 1 (again):

step 1 (again)

The deductions (two related ones)

The circled 2 has only three sides available, and a corner between two of those sides has a line leading into it. Only one border on either side of such a line can be used, so the one non-adjacent border must be used. Additionally, the leading-in side cannot bend away from the 2, as this would remove both of the 2's borders around that corner, so the below 2 cannot have its top side used

Step 2 (again):

step 2 (again)

The deduction:

The 2 can use either its two "naked" sides together, or its other two sides. Either way, the 4 must use its bottom 3 sides.

Step 3 (again):

step 3 (again)

The deductions (two related ones):

Both the 1 and the 4 have the same deduction, covered above: the "middle corner" must have a side leading out of it, for connectivity. This also means the non-"naked" sides of the 2 from the last deduction must be used, instead of the "naked" ones.

Step 4 (again):

step 4 (again)

The deduction:

Neither the 2 nor the 3 can use their shared corner all by themselves. If the 2 did, then the 3 would be forced to make a fork, and if the 3 did, then the 2 would only have one side left to use. Therefore the 2 must use its one non-corner side and the 3 must use its two "naked" sides.

Step 5 (again):

step 5 (again)

The deduction:

If the 4 doesn't use its "naked" sides, then it will have only three sides left. Therefore it uses its "naked" sides.

Step 6 (again):

step 6 (again)

The deduction:

If the 2 uses its bottom side, then there are three ends in the circled area. Three ends cannot connect to each other for a loop. Therefore the 2 does not use its bottom side.

From there the solution is trivial.

If any of that is too confusing, feel free to ask for clarifications in the comments.

$\endgroup$
2
  • $\begingroup$ Impressive answer! There is an easy deduction you haven't mentioned that can sometimes save you a lot of time: if you (mentally) draw a shape around any set of dots, whatever their number, then the number of lines that cross that shape is always even. Take that red circle in your last drawing (step 6-again) : there are two lines that are crossing it, therefore the bottom of the 2 cannot be a line. Also at step 5-again: see that isolated horizontal black line at the center bottom (West of a 3)? Over it there are two naked horizontal yellow lines that can be removed for the same reason. $\endgroup$
    – xhienne
    Commented May 20, 2021 at 21:27
  • 3
    $\begingroup$ You did use this kind of deduction several times in your answer, but you just expressed things differently (like "the line that comes here must go out at some point"). Don't consider this as a criticism, I just wanted to stress that you could introduce a general rule that you could refer to in order to accelerate things. Anyway, great answer, I would not have been brave enough to write everything down like this. $\endgroup$
    – xhienne
    Commented May 20, 2021 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.