X-Cycles are the start of a large family of 'chaining strategies' which are fundamental to solving the harder Sudoku puzzles. X-Cycles are strongly related to Simple Coloring.
A 'chain' is a series of links hopping from one candidate to another following very simple rules. A candidate can either be ON or OFF. That is, we either think it is a possible solution to that cell, or we do not. There are consequences to the rest of the board when we 'link' these two states.
In the X-Wing structure in Figure 1, as an example, we can consider B3 to be OFF. This forces the the 9 in B8 to be ON since it's the only remaining 9 in the row. If B8 is ON then that removes the 9 in H8. Again, the consequence is to turn ON the 9 in H3 - and that closes the loop by confirming the 9 in B3 is OFF.
In this X-Wing example three things are apparent. I went round clock-wise, but I could easily make the same logical chain going round from B3 to H3 to H8 to B8 and back to B3. Also, could decide that the start cell was ON and follow the loop round. And lastly, B3 is arbitrary, I could start on any of those four cells.
Another important way of thinking about this situation is from the point of view of the links. When a candidate is turned OFF AND there are only two candidates in the unit, then we can create a Strong link, as between B3 and B8 (marked in a thick blue line) and H8 and H3. Because there are just two 9s in each row, we know that if one is not a 9, the other must be. A strong link is where: !A => B (if not A, then B)
Weak links are the opposite:
A => !B (if A, then not B)
Strong and Weak links alternate just as candidates are turned OFF and ON. When we turn a candidate X ON we effectively remove ALL other candidates of X in ALL other units. However, when we turn a candidate X OFF it has no effect unless the unit has only two of X in it.
A "Cycle", as the name implies, is a loop or joined-up chain of single digits with alternating strong and weak links, as the X-Wing in Figure 1 shows.
In Figure 2, we have a 2-2-2-formation Swordfish re-drawn to show the strong and weak links. The loop characterises the X-Cycle, and the strong/weak links alternate.
Nice Loops have evolved a notation which is useful when accompanying a diagram or as part of an explanation. X is, of course, the digit, and we use the row letter and column number notation to identify cells (e.g., B2, F8). The cells in the loop are linked with a minus to indicated X has been turned OFF, and a + to indicated X has been turned ON - you will see these colours on the solver. An example:
+x[cell 1]-x[cell 2]+x[cell 3]-x[cell 4]
The 2-2-2 Swordfish above can be expressed as:
The only thing not explicit in this notation is that the last cell joins back onto the first cell. Thus, 4[F2]+[B2]. Loops can be of any length but they don't re-use any candidate.
Chains like these that go in a loop are called Continuous. They have three characteristics:
Firstly, it doesn't matter which way you walk round the loop - clockwise or anti-clockwise
Secondly, it doesn't matter which cell you start with (although the convention is to start with the top left-most cell)
Thirdly, each cell could be ON or OFF - as long as you alternate.
Even with the convention of starting with the top left-most cell, there are four ways we could write down a chain:
Clockwise with B2 ON+4[B2]-4[B4]+4[H4]-4[H8]+4[F8]-4[F2]
Clockwise with B2 OFF-4[B2]+4[B4]-4[H4]+4[H8]-4[F8]+4[F2]
Anti-clockwise with B2 ON+4[B2]-4[F2]+4[F8]-4[H8]+4[H4]-4[B4]
Anti-clockwise with B2 OFF-4[B2]+4[F2]-4[F8]+4[H8]-4[H4]+4[B4]
I've deliberately used neutral colours in the diagram above (yellow and blue) not to given the impression there only one way to write the same chain. However, the solver will return very positive red and green highlighting but that's because it has discovered one of those four ways first and discarded the other three identical ways.
In this example of an 8-Cycle in Figure 3, I have split the two possible states into two diagrams.
This shows how each pair of strong links (that have only two candidates in the shared unit) can be set overall. No other combination of ONor OFF is possible.
The notation can either be, left +8[B3]-8[B4]+8[C6]-8[D6]+8[F5]-8[F3]+8[B3] or right -8[B3]+8[B4]-8[C6]+8[D6]-8[F5]+8[F3]-8[B3]
The yellow cells are units where other 8s can be eliminated, which in this case correspond to the third column and boxes 2 and 5 because that's where the weak links are located. C4 is eliminated because of either B4 or C6
Nice Loops Rule 1
Nice Loops that alternate all the way round are said to be 'continuous', and they must have an even number of nodes. With a continuous X-Cycle, candidates are not removed from the loop since the loop does not have any flaws. Instead we are looking to eliminate on the units that can be seen by two or more cells that belong to the loop.
Figure 4 is a real-life example of an X-Cycle based on 8. The cells with links are in red and green. We can immediately see that C2/C7 is a weak link across the row because of the 8 in C3. G2/H3 is also a weak across the box because of the third 8 in G3. The last weak link is in box 9, J7/H9. Any other 8s in these units can be removed, which makes it a powerful technique. We end up with a loop containing only strong links – a result identical to a Colouring (Singles Chains) solution.
The output from the solver will contain the following information: X-CYCLE (Alternating Inference Chain): +8[C2]-8[C7]+8[J7]-8[H9]+8[H3]-8[G2]+8[C2] - Off-chain candidate 8 taken off C3 - weak link: C2 to C7 - Off-chain candidate 8 taken off C9 - weak link: C2 to C7 - Off-chain candidate 8 taken off G9 - weak link: J7 to H9 - Off-chain candidate 8 taken off G3 - weak link: H3 to G2
In summary we can see that
X-Wing is a Continuous X-Cycle with the length of four.
Swordfish of the 2-2-2 formation is a Continuous X-Cycle with the length of six.
Article created on 12-April-2008. Views: 331180 This page was last modified on 22-June-2012. All text is copyright and for personal use only but may be reproduced with the permission of the author.
Copyright Andrew Stuart @ Syndicated Puzzles, Privacy, 2007-2023
... by: GereHello
I am trying to learn more about solutions for Sudokus. I am really a newbie.
Is it necessary that a strong link is always followed by a weak link, or can two strong links follow each other?
You might not have read as far as this page: Weak and Strong Links
Which I hope will set everything straight regards the two types of link
... by: AsdayWhat about discontinuous cycles? I don't understand the solver's output for:
X-CYCLE on 9 (Discontinuous Alternating Nice Loop, length 8):
- Contradiction: When 9 is removed from A8 the chain implies it must be 9 - other candidates 8 can be removed
... by: JimHi Andrew,
You have a great site - I have learned a lot. It seems to me there is a slight bug in one of the Simple Coloring examples (the one with 2...41..6 in row A). After the 4th SC there is an X-Cycle, but the link from E9 to F8 is a strong link, not a weak link as shown. So it isn't a true X-cycle with 3 strong links in a row, or am I missing something? The puzzle solves OK, and if you remove the X-Cycle check box, the puzzle also solves using an XY-Chain.
Thought you would want to know.
... by: JimHi Andrew, I can get my head around most of the logic of your excellent illustrations of "x cycles" except how to select either a +(x) or -(x) candidate in the start cell of a Discontinuous Alternating Nice Loop. If you select (-x) to start you end with +(x) and the contradiction that (x) cannot be (-) and other candidates must be removed from the start cell. The opposite is true if you start if you start with (+x) and with the contradiction that (x) cannot be (+) and must be removed. Clearly one or other is the solution but how do you decide which to opt for.
Keep up the excellent work, your illustrations are second to none
... by: ArnoHi Andrew,
Near Fig.1 example, you wrote "Also, could decide that the start cell was ON and follow the loop round." But, in this case (startcell B3 ON), then B8 is off, but it will not mean that H8 is ON (B8-H8is weak link), so chain is not built.
I think that you can't go any direction (cw ot ccw) with both states (ON/OFF) on start cell:
If start cell is OFF, it must go thru a strong link; and if start cell is ON, then the first move should be thru a weak link.
If you agree with this, the 4th paragraph near fig.1 should have more restrictions, since it's little confusing.
... by: JustinHi, in your explanation of x-cycles you show an illustration using an 8 x-cycle, labelled Figure 3. I am still learning these techniques but if, as you say, this strategy elimates candidates that can be seen by 2 or more cells in the loop why in figure 3 is the 8 in C2 also not eliminated, please? It can see b3 and c6. Is it that it is not enough merely to see 2 cells in the loop, is it also necessary for the candidate we are looking to eliminate to be in the same unit as the cells it can see in the loop?
Sorry if this is a sill question. I really enjoy studying these strategies and consider your site to be excellent. I have spent many hours on it and have recommended it to friends, who are similarly impressed with it.
I have re-drawn Figure 3 and added some more text, to be more clear.
... by: britanicoDear Sir
Refering fig. 2 :nice loop on 4 it seems to me you can't start B2 OFF clockwise as you have a weak link to B4, that must start with ON state to provide any inference.Only if there's a strong link can then B2 start with a OFF state, clockwise.
Please, continue your good work and thank you for your kind attention.
... by: KavalaThis from puzzle 27th May 2017.
X-CYCLE on 2 (Discontinuous Alternating Nice Loop, length 6):
- Contradiction: When C7 is set to 2 the chain implies it cannot be 2 - it can be removed
I follow this but I see only five links and five nodes. Except you count the start and end nodes, which are the same, as two nodes ?
... by: IanI don't understand how you selected the 8s to begin with, and which ones to link to. Further explanation would be useful.
... by: Bob RodesI think there's an error here in Fig. 1, (and so also with your X-wing article which uses the same diagram). If B8 is on, that removes the 9's in BOTH H8 and F8. The consequence is to turn both F3 and H3 on, which is a contradiction.
... by: Mike Van EmmerikI can answer part of my own question in my last post: the second X-cycle in the third X-cycle exemplar is not a straight simple-colouring problem.
However, it seems to me that it can be solved with a simple extension of the simple-colouring technique. If you start on a particular square and end up on that same square at the end of a strong link (with an odd square count, starting as I do with zero), then it seems to me you have a Discontinuous Alternating Nice Loop situation, and the candidate in question (in this case, an 8) must be the solution, so other candidates in the start/end cell (in this case, one candidate, a 6) can be eliminated. I'll grant you that this is enough different from simple colouring to warrant a separate name.
I maintain however that all the other situations where the X-cycle has found the "first" solution, should have been found by the simple colouring solver.
I also note that simple colouring can be extended to grouped simple colouring, so the same comments apply to the grouped X-cycles. As a result, I don't believe that grouped X-cycles deserve to be in the "extreme" strategy category.
I'm guessing that the naÃ¯ve belief that a small group of general strategies (like simple colouring) can solve almost all Sudoku problems happens to most beginners like me :-O
... by: snaponitI second this question:
... by: Hilary
Your site is very helpful. The main problem I have with the puzzles that require diabolical strategies is that I don't know how to pick 'x' for the x-cycle for example. So I usually pick 'x' at random. But to me, that's trial and error and I was wondering if you had suggestions for a systematic approach
... by: HilaryYour site is very helpful. The main problem I have with the puzzles that require diabolical strategies is that I don't know how to pick 'x' for the x-cycle for example. So I usually pick 'x' at random. But to me, that's trial and error and I was wondering if you had suggestions for a systematic approach
... by: DoloresI am working on Andrew Stuart 8 Ex.1. I do not understand this explanation: X-CYCLE on 5 (Discontinuous Alternating Nice Loop, length 8):
- Contradiction: When 5 is removed from E8 the chain implies it must be 5 - other candidates 2/4/8/9 can be removed
Also, how do you choose which 5's to include and which to exclude in the chain. Because most of the squares had a 5.
Basically, if 5 is removed the knock on effect - if you trace it all the way round the chain - is that 5 is put back in that starting place - which is a contradiction. So we can deduce 5 must be the solution to that cell and we can remove everything else.
... by: CathyFigure 1 is missing from your article (the url in the page's source ends in .jpg, but the actual image ends with .png)
... by: JimSLaura,
Maybe Andrew answered your question privately or maybe it is posted somewhere else on this site but I thought that I would try to answer your question.
As you follow a continuous, alternating nice loop along the path some of the weak links can actually be strong links -- they just don't have any digits that can be eliminated. Imagine an X Wing which only has digits that can be eliminated in one unit not two.
Andrew might be more accurate if he said "weak or strong links" instead of just "weak links" but that would be cumbersome and wouldn't really help the understanding of the concepts.
Hope this helps.
... by: LauraI thought only strong links could have weak interference - not the other way around. I have come across several puzzles in which your solver showed a weak link and it should have been strong- there were only 2 of that number in the square. Is there a special circumstance where this could happen? Please advise thanks
... by: ECCThe missing detail in the explanation is that any odd length sequence of strong links counts as a single strong link, except that it cannot close the loop. That is, two consecutive strong links in a loop gives you an answer as described under discontinuous loops, but four does not.
... by: Elleda KatanI'm finding again a problem I have encountered before : what seems like a contradiction between your explanation here and how x-cycles are 'used' in some of the daily puzzles. I'll use 4/5 [todays] as my example but I hit the same problem in 2/28 & elsewhere.
 In none of the x-cycle demos is the digit removed from the cells forming the loop. Instead it is eliminated " from cells that can be seen by two or more [loop] cells." In the 4/5 puzzle 7 is eliminated from E1, the beginning and end of the loop.
 The end result says your explanation is a loop containing strong links. However, in 4/5, eliminating 7 from E1 destroys the loop.
 In the documentation under the 4/5 puzzle, the loop is described as : 7[E1]-7[E4]=7[J4]-7[J3]=7[G1]-7[E1] "Discontinuity is two weak links joined……" However, 7[G1] to 7[E1] is a strong link, not a weak one, no? Shouldn't it read : 7[G1]=7[E1]?
Please I love love love your puzzles and am trying to get smarter at understanding the more advanced strategies, but this confusion has me X-ing out x-cycles from solutions because I am so baffled by them. Thank you for your time.