Categories
Classics Collection

Classics Collection: Yajilin

Here is the next installment of our beginners series. You will notice that this is the third post in our Classics Collection within a month; however, the reason for the rush is actually quite simple. Some time ago I decided that the next CC group will be about Yajilin, and it so happens that the UKPA is hosting a Yajilin (and variations) contest this weekend. The puzzle style collision is purely incidental, but I figured it would be prudent to publish our puzzle set before the contest rather than after it. Here is the PDF file: Yajilin

Rules: Place some blocks in the grid, and draw a closed loop that runs horizontally and vertically and passes through each cell the except the clue cells and the blocks exactly once. Clue cells cannot contain blocks, and cells with blocks cannot be horizontally or vertically adjacent (they can touch each other diagonally). The numbers indicate how many blocks appear in the specified direction.

Example and solution:

A couple of remarks are in order before we get to the part about solving techniques. First, regarding the rules. If you are unfamiliar with Yajilin, the example shows several situations worth mentioning: there may be blocks with more than one clue pointing at them (R4C4) or no clue at all (R3C2); blocks may touch each other diagonally (R1C3 and R2C4), and they may be adjacent to clue cells (in this case all of them); clues can see through other clues (R2C4).

Yajilin is a weird puzzle type which combines elements of different categories. I view it as a Loop Puzzle in the first place, although it is hard to overlook the part about the blocks, which puts it in close range with Placement Puzzles. Most authors use a different layout with shaded cells instead of blocks (and the clue cells may also look different), though, which would make it a Shading Puzzle. In the end, the classification is not important; the point is that you will encounter substantially different layouts for this puzzle style. I currently prefer blocks to shaded cells, but when you look for Yajilins in contests and on other puzzle-related pages, you will find that the latter is the prevalent version.

And one more thing. A quite common feature of Yajilin puzzles are “clue cells without clue”, i.e. grey cells which are excluded from the loop but which do not contain an arrow and a number. I am not very fond of this, although in fairness it gives the author a lot more control about the solving path. Anyway, you will find no such cells in this set. (As an aside, a popular Yajilin variant features clue cells with a number but no arrow, meaning that the clue counts blocks in all directions. I am sticking to the original version here.)

Now, where to begin. If one has located all the blocks, drawing the loop is extremely easy. (There is a puzzle type known as “Simple Loop”, but it is such a basic task that it barely deserves the Logical Puzzle tag at all.) On the other hand, there are far too many possibilities to draw a closed loop inside a mostly empty grid, so ignoring the task of locating blocks is not an option either. The beautiful thing about Yajilin is that the two elements – the loop and the blocks – usually go hand in hand, and one must keep track of any progress in both regards. In particular, I would recommend to mark cells which cannot contain a block, for example with a small dot.

Let us study a few elementary constellations. In Yajilin 1 from the PDF file you can see a narrow passage in the bottom-left corner. The cells R4C1, R5C1, R6C1 and R6C2 are either all visited by the loop, or none of them is (since there is no space to make a turn or otherwise exit this group of cells). As it is not permissible to place two blocks in adjacent cells, let alone four, the entire passage must be part of the loop, and one can draw loop segments starting from R4C2 going West, and exiting the passage in R6C3.

Something similar happens on the East edge of the grid; the loop must pass through the loops R2C6, R3C6, R4C6 and R4C5. In general, any “passage” which consists of at least two cells must be part of the loop. I did not give a definition of the term, but I hope you know what I mean. On the other hand, there are “dead ends” like the corner cell R6C6; such cells have to contain a block. Note that, since blocks cannot cover adjacent cells, R6C5 must once again lie on the loop, hence one can draw the connecting segments from here to R5C5 and R6C4.

By the way, the cells R1C1 and R2C1 also form kind of a passage. You should keep this constellation – a clue located on an edge, two cells away from a corner – in mind, as it occurs quite frequently. Later it will turn out that there must be a block on R3C2, so what we get is a “well” of depth two in the two top rows. All cells in that well must lie on the loop.

Please observe how crucial the “width” of two for a well is; if it was any larger, it could accommodate one or more blocks. However, a clue may change this: the left part of the top row in Yajilin 2 is (kind of) a well of size 3, yet the clue of 0 tells us that it does not contain a block. As a consequence, one obtains loop segments from R2C1 via R1C1, R1C2 and R1C3 to R2C3.

In Yajilin 2 we also see an almost closed region near the top-right corner. This is not quite the same as a passage in the sense from above, although a similar principle applies: since there are just two entrances/exits and it is impossible for all cells in this area to contain a block, the loop must enter and leave said region. A priori this does not yet imply which of the respective cells lie on the loop (after all, there is room for blocks), but the region also includes a well, and that is sufficient to mark the exact route.

So much about drawing loop segments right away; what about blocks? The most fruitful clues are typically those which are very large, compared to the number of grid cells they can see. In general, at most every second cell can contain a block, therefore clue values which come close to half the grid size are often a good starting point. However, it may also be a good idea to have a look at smaller clues which point in a shorter direction.

In Yajilin 1, the clue in R3C5 points at two empty cells. Again, this is a constellation worth memorizing. The point is that the cell in R1C5 cannot contain a block, or else it would create an “impossible” dead end (requiring another block adjacent to the first one). Simply put, an empty corner cell can never be adjacent to a block. Thus only one possible location for the block North of R3C5 remains, namely the cell R2C5. This block extends the passage on the East edge we have already studied and gives rise to more loop segments.

In Yajilin 2, the clue of 2 in R3C4 points at three empty cells. There is only one way of placing two blocks here, namely in R4C4 and R6C4. The other clue of 2 implies that a third block must be placed in one of the cells R4C1 and R4C2; we just do not know yet which one. The clue of 2 in the corner cell R6C6 of Yajilin 3 may appear to leave plenty of possibilities, but that is an illusion. The cells R6C2 and R6C4 must remain empty, i.e. part of the loop, since they are adjacent to a corner (note how the cell R6C5 effectively becomes a corner due to the clue). And two blocks along an edge with one cell between them would create another impossible dead end. Hence blocks can be placed in R6C1 and R6C5.

Sometimes, the available cells are reduced by loop segments (which one has discovered earlier) until there is only one location left for a block. The clue in R5C2 of Yajilin 1 points at four cells to begin with, but three of them are ruled out by the loop segments we have found thanks to the passage in the bottom-left corner and the well in the top-left corner. This yields a block in R3C2 – I mentioned above that this block would follow in due time, and here it is.

Clues of zero may appear less helpful, and at the beginning this is indeed often true. An exception occurs when it points at passages of size 1, as in Column 3 of Yajilin 4; the loop must pass through both R4C3 and R6C3. (Without the vertical clue, either of these cells might contain a block.)

At this point I would like to reiterate that blocks and loop segments must usually go hand in hand in Yajilin puzzles; at some point one cannot make progress of one kind without the other. Each loop segments eliminates potential locations for blocks, and in return blocks often yield loop segments, since the adjacent cell must lie on the loop.

To see what I mean, let us have another look at the puzzle Yajilin 3 from today’s set. The blocks in the bottom row imply loop segments from R5C2 via R6C2, R6C3 and R6C4 to R5C4. This portion of the loop severely limits the available space for the required two blocks in Column 4 (from the vertical clue), and in fact we can now enter blocks in R2C4 and R4C4. Those blocks, in return, yield a passage from R3C3 to R5C3, and an enclosed region in the right-hand part of the grid, which needs an even number of entrances/exits. And so on.

Even when a clue cannot be fully exploited at a certain point, one should keep marking cells which one has found to be empty. There are more constellations which I have not covered yet and which might suddenly pop up to eliminate more locations. For example, look at the clue in R5C6 of Yajilin 1. It appears that there are several locations left for the block in Row 5, but see what happens.

The cell R5C5 lies next to a (quasi-)corner in R6C5, so it must remain empty. Can the cell R4C5 contain a block? Let us do a mini-bifurcation. If we had a block in this position, the loop segment starting in R6C3 (which we derived from the corner passage) would have to go both North and East at the same time, since the block would create two more passages. This is impossible, though, proving that the cell R5C4 must remain empty. All of a sudden, we are only left with the one possible location in R5C3. And, like before, this yields more loop segments: from R6C3 via R6C4, R6C5, R5C5 and R4C5 to R4C4.

There is one other interesting constellation I would like to mention, namely two parallel clues in adjacent rows or columns. The clues in R4C4 and R5C3 in Yajilin 5 demand three blocks in the top part of the respective two columns. The available group of seven cells is far from spacious; try it out a little, and you will find that there is only one possibility. In general, it is impossible to place three blocks in a rectangular 2×3 region (free of clue cells), or two blocks in an empty 2×2 square near an edge; either attempt would create a dead end and thus a contradiction.

In Yajilin 6 we see two parallel clues in the Columns 4 and 5. More to the point, these clues require one block in either R1C4 or R2C4, and – using the insight from the previous paragraph – another in R3C5 or R4C5. However, a block in R3C5 is impossible; this is (literally) the same bifurcation trick we already used in Yajilin 1 a little earlier. Hence one obtains a block in R4C5, and it turns out the loop in the right-hand part of the grid will eventually tell us where the block in Column 4 must go.

Naturally, all of this can be extended to solving steps in larger clue constellations, such as three parallel clues, but let us not overcomplicate things. Virtually all the puzzles in today’s set can be solved using the techniques I described above, and in fact most Yajilins you will encounter in practice can as well; the difficulty often just lies in finding the next step.

This should do for an introduction to Yajilin. Enjoy the puzzles.

2 replies on “Classics Collection: Yajilin”

I look forward to giving these a go!

On Simple Loop: there are definitely some examples I’ve seen that go beyond a basic level, although I would add that even then there isn’t that much variety to be had.

On etymology and puzzle classification: my understanding is that Yajilin specifically refers to arrows, which I think is interesting. I saw recently a complaint that the variant “Regional Yajilin” is nonsense, from an etymological point of view, and it triggered a memory of a puzzle in the GP going by the name Loop (Shaded), which was much the same thing except that clues for non adjacent and non loop containing cells were given outside of the grid. I think what I take from all of that is I agree you have to include both object placement and loop drawing as far as classification goes.

Bonus comment: I recall a conversation many years ago with a precocious talent going by the name Palmer, where he mentioned he liked to give himself a extra challenge on nikoli.com Yajilin puzzles. What did he do? He placed all the shaded cells first, and then drew in the loop!

The puzzle classification is a pet project of mine which, I admit, I am bringing up every now and then for no particular reason. My point – in this case – is that we have two fundamentally different tasks which work together quite nicely. That is not always the case, and in fact I could think of very few “basic” puzzle styles with this property.

In general, I am under the impression that the community is coming up with a lot of puzzle styles (most of them hybrids of some kind) trying to create exactly such a kind of balance. It rarely works, at least to my taste, because the combination of tasks usually comes at the price of an increased complexity of the rules. We might call these “designer puzzles”.

I am not claiming that Yajilin is the most “natural” puzzle style, compared to Sudoku, Slitherlink, Nurikabe, etc. Still, I find the rule set of Yajilin rather intuitive, compared to many other hybrid puzzle types. (Otherwise, I probably would not have added it to this series.)

Leave a Reply

Your email address will not be published. Required fields are marked *