This is a three-dimensional Masyu puzzle. The five squares depict the layers of a $5\times5\times5$ cube. The goal is to make a single loop in 3D space which fulfills the following properties:
- The line passes through centres of cells and makes 90-degree turns only.
- The line cannot cross itself or branch off in multiple directions.
- The line passes through every white and black circle.
- When passing through a white circle, the line must go straight through the circled cell and make a turn directly before or after that cell (or both).
- When passing through a black circle, the line must make a turn in the circled cell and continue straight through at least one cell on both sides.
Note: Feel free to use any notation you feel the most comfortable with, as long as it's properly explained. My way is to use diagonal lines to show movement between layers.
$\begingroup$ May I suggest "through" rather than "for" in the last bullet point? I think that makes it harder to misinterpret. $\endgroup$– Gareth McCaughan ♦Oct 14, 2019 at 13:02
1$\begingroup$ A ray-traced solution would be awesome. $\endgroup$– Daniel MathiasOct 14, 2019 at 13:09
$\begingroup$ I've experimented a little with ray-tracing and it's less good than you'd think. Unless you also have the ability to spin things around in 3D etc., it's hard to see what's going on. $\endgroup$– Gareth McCaughan ♦Oct 14, 2019 at 15:23
Solved! I use X, Y, and Z as axes to describe my logic.
White circles along edges have only one possibility:
Then the line through white circles in the bottom right of #2 must be in Z; if they were in Y, the black circle in (5,4) of #1 would be X and Y, leaving the white circle in (4,5) of #1 with nowhere to go. This forces a turn in (5,5) of #4, which means that (5,5) of #5 does not turn Z. A few other simple deductions later:
The black circle in (2,1) of #1 can't be Y and Z, as then the white circle in (2,2) of #2 would have nowhere to go. It also can't be X and Y, as then there would be a Y line through (2,2) of #2, which would have nowhere to go from (2,1) of #2. Thus it's X and Z.
The black circle in (1,3) of #3 only has two legal directions left. This forces (1,1) of #5. We then note that the white circle in (2,3) of #2 must be in X. A few more simple deductions:
A line in Z from the black circle in (2,4) of #5 would end up stranded, so that black dot is in X and Y. The line must turn in (1,5) of #2 - it's gone through two white circles. A colour-coded image at this point, showing the paths so we don't get separate loops:
The most obvious deduction at this point is that (5,4) of #3 can't go down. That swiftly brings us to our conclusion!