# A Total Masyu puzzle

In a Total Masyu puzzle, one must draw a single loop through the centres of some cells according to the following rules:

1. The loop may only travel horizontally or vertically, never diagonally; all turns are right-angled turns. The loop may only turn at the centers of grid cells. The loop may not cross itself or branch off; that is, from any cell centre, there can be only 0 or 2 loop segments extending from it. (Basically, it expects exactly as a loop in most loop logic puzzles behaves.)
2. The loop must pass through every circle.
3. The loop may not turn at a white circle, but must turn at at least one of the adjacent cells in the loop.
4. The loop must turn at a black circle, but may not turn at either of the adjacent cells in the loop.
5. A cell without a circle cannot behave as though it had one. Or rather, all possible circles that fit the solution are given.

Prove or disprove: The Total Masyu puzzle below has exactly one solution. (It doesn't contain any black circles; rule 4 above is present just for completeness.) (This puzzle was originally published on my rather small blog here.)

• Remark: rule 4 is not really present "just for completeness" because without it the meaning of rule 5 would be different. Feb 12 '17 at 14:00
• In general, that is true. But in this puzzle, at least, it doesn't matter. Feb 12 '17 at 14:23
• I am with TeamGareth on this one. If rule4 wasn't present, rule5 would allow an empty cell with a right turn which progresses with a straight line in boths its neighbouring cells. Feb 12 '17 at 14:40
• That is true in general, but in this puzzle, such a cell can't exist. Feb 12 '17 at 14:47
• @MarnixKlooster: Rule 5. This solution doesn’t work, for example, because then there would be a white circle missing: i.stack.imgur.com/ienTL.png
– Ry-
Feb 13 '17 at 10:12

First of all, let's adopt the convention that the path runs "macroscopically" anticlockwise. Now,

colour the cells in checkerboard fashion -- let's say black at the top left. And colour the path red when it is entering a white cell horizontally or leaving one vertically, blue when it is entering a white cell vertically or leaving one horizontally. So the path changes colour in the middle of a cell that it passes straight through, and stays the same colour when it turns in a cell.

Now, in a Total Masyu puzzle, when the path enters an empty square

it must turn if, and only if, it turns at at least one of the adjacent squares. Equivalently, it must NOT turn if, and only if, it doesn't turn at either adjacent square. Taking just the more interesting half of that equivalence: if the path passes straight through an empty square, it must continue straight until it hits a circle.

Therefore,

the portion of a path between any two circles is either always-turning and monochromatic, or never-turning and changing colour every square. When the path passes straight through an empty circle, it changes colour.

The path forms a single loop, so

its total number of colour-changes is even. There is one at each empty circle (since it passes straight through these), and therefore there must be an odd number of others. These others can happen only on a straight-line path segment -- so the path must run vertically straight through the two rightmost circles, and straight between them.

In that case

it must also go vertically through the other circle. It can't go into the corner because then the square left of the left-hand circle would be eligible for an empty circle, so the path bends in a "U" below those two circles. Now, above the left-hand circle the path can't continue straight (it doesn't have a circle to aim for), so it must turn; and now in fact its every step is determined until it finally ends up meeting the other branch of the path.

So

indeed there is exactly one solution to this Total Masyu, and it looks like this: • Well done. Different people have expressed the parity constraint in different ways, but regardless, the conclusion is as you describe. Feb 12 '17 at 14:56
• I think there's a better way to look at it than the one currently in my answer, and I'm just seeing whether I can actually make it come out cleaner. Feb 12 '17 at 14:57
• Done. I think this is simpler and clearer than what I had before. Feb 12 '17 at 15:29