## Monday, 17 February 2014

### Tutorial: Turning Fences

This week the LMI Puzzle Marathon will start. It will run from February 21st till March 2nd. For this event I have written a Turning Fences puzzle. To prepare people a bit for a more unknown genre, I will write a tutorial about the logic behind the genre. It won't be complete, but it should be enough to tackle the upcoming puzzle. In the next days there will also be a few practise puzzles. You can also practise some of the puzzles already on my blog, but most of these are logically harder than the puzzle in the actual test. For those who happen to own Akil Oyunlari Issue #75, there are also 4 of these puzzles by my hand in there. They are logically a bit more friendly.

Tutorial below.

Rules
Draw a single closed loop by connecting dots horizontally and vertically. The numbers in the grid indicate the amount of turns taken on the four dots around it.

Basics

The puzzle type somewhat looks like the standard Slitherlink puzzles and has some similarities in the layout and the way you have to avoid multiple loops. But that's where the comparison in solving pretty much stops. The solving of a Turning Fences puzzle pretty much always starts on the edge of the grid. This is because knowing that a turn finds place on a dot, still leaves four ways to draw that turn, but on the edge this is reduced to two ways. So to start Turning Fences puzzles you should direct your focus to the edges and corners of the grid.

It is important to keep good track of which dots are turns and which dots are not turns in this puzzle type, even if you can't actually deduce the way the loop goes through the loop. Knowing that one dot can't be a turn or has to be a turn, can determine the other dots around a number and give you lines and/or crosses.

For this tutorial I will be indicating dots that have turns with green and dots that don't have turns with red.

If a dot on the edge has a turn, you can always draw a line away from the edge. If a dot on the edge has no turn, you can cross out this line running away from the edge.

If a line reaches a dot without a turn it will always go straight, so can draw the line through the dot and cross out the sides. If a line reaches a dot with a turn, the line will have to turn, so you can cross out the segment going straight.

If there is a cross next to a dot with a turn, then a line segment can be drawn in the opposite direction. If a cross is next to a dot without a turn, then a cross can be drawn in the opposite direction.

That is the basic solving technique of this puzzle type.

Numbers on the edge of the grid
As mentioned before, the edge of the grid is the starting point of any Turning Fences puzzle. So what can we do with numbers that are on the edge of the grid.

The number 0

The number 0 on the edge of the grid is pretty simple. You can draw four crosses as the loop always have to turn when leaving the edge of the grid. The same then goes on the dot one row off the edge.

The number 4

The number 4 on the edge has 3 different ways of being drawn. These options all have 2 lines and 2 crosses in common. So you can draw these at the start.

The number 2

This is where the logic gets a bit more complicated. There are too many options to draw out on how the turns can behave. There are already 6 ways to distribute the places where the turns are located.
But there are some deductions that can be done with a 2 on the edge. The two indicated segments running away from the 2 are always both a line segment or always both a cross.

So if the solve forces one of them to be either a cross or a line segment, you can also place the other one.

The number 1 and 3

I am doing these together as the logic on the edge for both is the same. Just like the number 2, there are too many ways this number can behave to draw any direct deductions on its own. But just like the number 2, there is some generalised logic to be learned from these numbers.
With the number 1 and 3, the two indicated line segments always have one segment being a cross and one segment being a line.

So if you know that one segment is a cross, then the other one is a line. And if you know one segment is a line, then the other one is a cross.

As you can see I indicated that the two dots under the cross in the 1 can't have a turn and under the 3 both have a turn. This lets you draw the extra line and cross in the image.

Practise puzzle #1

Here is a first practise puzzle to show how the above can be applied.

First we look at the 0 and 4 as we know where the turns are for these numbers. We can place a number of crosses and lines.﻿

Now we can look at the numbers to the right of the 0. As we know that one of the segments leading away of the 1 is a cross, the other must be a line. Now we can look at the 2 and deduce that the other segment leading away from the 2 is also a line. Then we look at the 3, where we know the other segment leading away from the 3 must be a cross. We also know where two of the turns around this 3 now go and we can mark these as turns.
We can do a similar thing with the numbers to the left of the 4, leading to the given lines, crosses and no turns.

Now we can look at some of the other numbers. We can see that both 3s on the right already have one dot marked as not being a turn. This means that for both the remaining three dots must be turns. Now we have both 2s on the left with two turns marked, so we know that the other two dots must not be turns. Now we know how those dots behave, we can draw the given lines and crosses.

When we look at the right, we can see that the top 1 already has one dot marked as being a turn, so we know the other dots can't be turns. This means we can draw a number of crosses and lines around the 1. If we look at the 1 below, it has one cross leading away from it, so the other must be a line. IF we then look at the 2, we can see it has one line leading away from it, so the other segment must also be a line. The same now goes for the 2 below that.

Now we can draw some more loop if we look at the bottom right. The lines around the 4 must escape to the right and left. To the left it has to connect to the line between the 2 and 3.
Now you can look at the left and see that the end in the bottom has to go up and the two end in top have to connect to eachother.
When you then look to the right top, you can see this end has to escape to the right and downwards.

Now we come to a bit trickier step that we haven't discussed before. But it should be clear anyway.
If we look at the 1 in the middle, we can see that the right lower dot can't be a turn. Because if it were a turn, the line would have to travel up, but then the right top dot would also be a turn. That would mean we have two turns around a 1 and that is not allowed. So we know the right lower dot is not a turn and the line has to go straight.
This is one of the more important observations you can make in the later stages of a solve of a Turning Fences puzzle, to avoid getting more turns then allowed around a number.

Now we can simply finish the puzzle when starting from the lower right. Below is the finished puzzle with all relevant dots marked as turn and no-turn.﻿

﻿
Numbers in the centre

The numbers on the edge will give you a good way to start, but eventually you'll actually have to go to the middle.

The number 0 and 4

The number 0 and 4 behave very simply. Whenever you get to a number 0 or 4, you can use the basic rules, to draw lines and crosses around it.

The number 2

There is a similar rule for a 2 in the centre as there is for a 2 on the edge. The rule is that there are always an even number of horizontal line segments leading to a 2. The same goes about the number of vertical line segments leading to a 2. Below some examples of that.

This means that when you have three horizontal or three vertical segments leading to a 2 filled out, you can determine if the fourth.

The number 1 and 3

There is also a similar rule for a 1 and 3 in the centre. The rule is that there is always an odd number of horizontal line segments leading to a 1 or 3. Again the same goes for the number of vertical line segments. Below some examples of that.

This again means that when you have three horizontal or three vertical segments leading to a 1 or 3, you can determine the fourth.

Number Interactions

Of course there are a few number interactions that should help you determine which dots are turns and which are not. There are also number interactions that help you determine some lines or crosses.

1-3 pair

The simplest and most common pattern is an adjacent 1 and 3. Because a 1 can only have one turn, this means that only one of the two dots between the 1 and 3 can have a turn. This means that the other 2 dots of the 3 both have to be turns. Because of this the two dots around the 1, that are not adjacent to the 3 must not be turns, as the one turn around it must be between the 1 and 3.

1-2-1 trio
Another pattern is a 2 between two 1s. This leads to deductions in a similar logic as the first pattern. A 1 can only have a single turn. So on each side of the 2, there can only be one turn. This means to get two turns, it needs a turn on each side. So for both 1s the turn has to be on the side that shares an edge with the 2. This means that the two dots not shared by 2 for each 1 can't be turns.

Remember this pattern only works when they are in a horizontal or vertical line. It doesn't hold through diagonally or in a corner.

3-2-3 trio

This pattern works the opposite way of the above pattern. A 3 needs at least one turn on every pair of dots. So on each side of the 2, at least one of the two dots needs to have a turns. As there can only be two turns around a 2, each side needs one turn. As each 3 can only have one turn in the dots adjacent to the 2, the other two dots around the 3 must both be turns.

Remember this pattern only works when they are in a horizontal or vertical line. It doesn't hold through diagonally or in a corner.

There are a lot of ways these patterns can be hidden. It is therefore important to remember the logic behind these patterns. Try to notice when a pair of dots can only have one dot, or when a pair of dots needs to have at least one dot. And then see if this interacts with the numbers around them.

The distant 0

A 0 can lead to interactions from a distance. This occurs when a line is forced through them, but you aren't sure which one yet. This may sound a bit confusing, but I will explain.
As mentioned before, a 1 or 3 on the edge must have one line leading away from it and one cross. If either of these lines would reach a 0, then they both would have to go straight. This means that the line can't go through the 0 in the different direction as seen below. This leads to a number of crosses that can be drawn.

This interaction doesn't always have to occur near the edge. It can occur anywhere you can deduce that one of two lines leads to a 0.

Practise Puzzle #2

Let's solve one of the harder puzzles on my blog using things from above. I've chosen puzzle #91.

Let's first start marking some of the turns and no-turns. There's a few 0's and 4's. But we also see the 1-3 pair turn up numerous times.﻿

Now we can draw the first few lines and crosses that we can now deduce.

Let's now start and look in the left top. We can see from the corner 3-1, we have to go straight at the top and the other dot must be a turn. We can them figure out how the lines go around the 1-3 pair just below it.

Now we look at the 3-1 pair in column four. The left bottom dot can't be a turn, because then the right bottom dot would also be a turn and there are too many turns. So that one has to be a no-turn. We can fill out a number of lines and crosses again now.

Now when we look at the 1 in row 4, we can see it has to turn in the left top dot as otherwise we would create a loop. Thus the other three dots are no-turns. Now we have two no-turns around the 2 in row four, so the other two dots must be turns. We can draw a bit more of the loop to the right.

Now we look at the 1 in row six. The left top dot can't be a turn as then we would have two turns around the 1, so the line goes straight down. The right top can't be a turn as it would create an extra loop, so it goes down straight. Now the left bottom dot can't be a turn as it would either create an extra loop or two turns around the 1, so the line goes straight down again. This means that the right bottom dot has to be a turn.

Around the 2 in row six, we now have to avoid creating an extra loop. To do that the right top dot has to be a turn. This leads to more line segments using the 4 and surrounding numbers.

We can now draw some simple line segments using the 3 in row seven as the left bottom dot has to be a turn, now the left top dot is a no-turn. We can also apply some edge reasoning with the 1-2 pair in row ten.

Now we come to the hardest part of the puzzle. this really uses the logic we learned about numbers in the middle of the grid. From the edge logic for 2s we know that both the purple circles have to be a line segment or both have to be a cross. This means there's always an even number of line segments there. If we now look at 1 in column eight, we can deduce the fourth vertical segment. We know the 1 always has an odd number of vertical line segments going to it. As the top two vertical line segments always have an even number of line segments, we know that the bottom two vertical segments always have to have an odd number of line segments to create an odd total. As we already have one cross, we know that the one line segment has to be a line.
We can employ the same logic with the yellow circles and the 3 in row eight.

Now we can finish filling out the 3 in row eight as we know the right top dot can't be a turn. The whole bottom left can now be filled out by avoiding creating an extra loop. We can also fill out a little bit of loop from the 3 in row seven.

Now with a bit of edge number logic with the 2-3 pair in row ten, we can fill out a lot of the right edge.

A way to continue now, is to count the number of ends in the bottom right corner. We can see there are seven ends there. as we always need en even number of ends to create a loop, we need an eighth loop end. This forces the line segment between the two 4s in column five to go down.

Now a way to fill out this bit is to count the horizontal segments around the second 2 in row nine. We have two horizontal line segments and one cross. As the total of line segments has to be even, the fourth segment has to be a cross. Now the bottom fills out simply.

Now to finish the top right of the grid. We can start at the 4-3 pair in column six. The loop there only has one way to go. This then force the left bottom dot of the 1 in row one to be a turn. So the rest are no-turns. Now the 2 in row one has two no-turn dots, so the other two dots need to be turns as well. And we can draw a whole bit of loop again.

The last bit can easily be solve with some edge number logic on the 3-2 pair in column ten. And finally we have to connect the last two ends around the 1, so it only creates one turn.

And this is how the puzzle looks when solved.

I hope all of this was clear and will be useful when you solve my Turning Fences puzzle in the LMI Puzzle Marathon. If anyone has questions regarding this tutorial, feel free to leave a comment.

1. Thanks for taking out time and putting up tutorial.
And now its seems to be very interesting puzzle.
Awesome post. :)

2. Brilliant Bram, many thanks for this. Just need to remember those utterly obvious rules!

3. Absolutely brilliant post. After reading it I ran around and did all of your prior Turning Fences puzzles. The problem was that I loved them, but than ran out of puzzles to do. Your are like a drug dealer that gets its clients addicted and then holds out the goods. Looking forward to your LMI marathon puzzle. Then what?!

Thanks again.

TheSubro

1. Well you got them hooked with the free samples and the you can charge them good money. You got to know how to work the field.

But more seriously, thanks.

4. That's brilliant Bram, thanks for taking the time to write this, and showing that there is deeper logic to these puzzles than first appears. :)

5. one query,
it said that around even number, number of incoming lines are also even so is 0 included in that case ?

1. Yes, it goes for 0 and 4 too, except you don't need that logic to get those deductions as you can just use the basic logic for crosses and lines near turns and non-turns to deduce everything.

2. ok thank you :)