UPDATE: I changed the image to reflect an actual X-Wing. As a matter of fact, this is the puzzle that I posted a couple of days ago under the “daily Sudoku” page.
Here is a quick explanation for the “X-Wing” technique. Suppose you reach the following position and you can’t go any further:
You look at columns 4 and 7 and you search for cells where digit 1 is a candidate. You find that only R4C4, R4C7, R8C4 and R8C7 have 1 as a candidate. So all 4 of those cells that belong to columns 4 and 7 (2 different columns) belong to 2 different rows (4 and 8 ). Now, digit 1 must be somewhere in both columns 4 and 7 – but if it must be in rows 4 and 8 then digit 1 can be erased from rows 4 and 8 except of course from R4C4, R4C7, R8C4 and R8C7.
So, this technique doesn’t solve a cell. It only eliminates candidates from some cells, which could help you solve the puzzle. But in this case, it indirectly solves R4C9=9 (you eliminate 1 from there).
That was X-Wing. Swordfish is a more complex version. Basically, you’re looking for any number of columns (let’s say “n” columns) that can have your chosen digit in up to “n” different rows. Then you can erase that chosen digit from other cells in those rows.
I’m terrible at explaining things. This only proves it. lol
26 Comments
I don’t mean to be picky, but I think this might be better explained with an actual example — numbers included all over the place. I can’t help but look at this one and think of the 134 naked triplet in the 2nd row, which appears to make the puzzle invalid (if what you say about columns 3 and 7 wrt digit 1 is true).
In other news, keep up the good work. I just ran through some archival problems and had me a great time — although I had to think for so long, my pasta got cold!
I think I would agree with ZD on this one, especially as there are so many naked singles on the grid as posted which makes it fairly simple to solve!
Cathy, did you actually try solving the puzzle from the given position (including naked singles?). If you can solve it without using x-wing – please let me know how. In other words – what is your next step from this position?
ZD’s comment was to the first example that I posted which has since been replaced by this one that you see now (see “UPDATE”).
Thanks!
Actually, no I hadn’t DJ. Sorry – guilty as charged :(. In fact this puzzle does require an x-wing to progress. Having put in all the naked singles, hidden singles and made other eliminations due to locked candidates, the grid was as follows:
+—+—+—+
|3.8|2.1|…|
|1.9|…|273|
|..2|…|4..|
+—+—+—+
|2.5|..8|.4.|
|917|324|865|
|..4|5..|7.2|
+—+—+—+
|491|…|…|
|526|…|…|
|..3|6..|9.4|
+—+—+—+
Then there’s an x-wing of 1s in r6c5, r9c5, r6c8 and r9c8 – leading to placement of 8 in r3c8. The rest is straightforward placement of naked and hidden singles until the solution of:
+—+—+—+
|378|241|596|
|149|865|273|
|652|937|481|
+—+—+—+
|265|178|349|
|917|324|865|
|834|596|712|
+—+—+—+
|491|753|628|
|526|489|137|
|783|612|954|
+—+—+—+
Cathy, you’re quite right about the X-wing in r6c5, r6c8, r9c5 and r9c8. Of course, there is also the X-Wing that I chose to show in the example. Either one of them would solve the puzzle, but the point is that this puzzle requires X-Wing and that now you know what X-Wing is :).
Well, I knew what an X-wing was before (though I have trouble understanding some of the other advanced techniques)!
However, I would still argue that the x-wing shown in your diagram is not the one that is *required* to solve the puzzle when you can fill in several other cells from the naked and hidden singles and make a few more eliminations before you get to the point that I posted above.
Actually – scrub that last comment! You can use either X-wing. I should learn to think before I speak!
Hi, could somebody try to explain once again that x-wing technique. I am a little lost.
Thank you.
Erny
Ok I did not have any response yet, so I tried.
If I take r4c4,r4c9 and r8c4 and r8c9 I have the digits 1 too. If I eliminate 1 in r4 I gat in r4c7 as a result 3, if I do eliminate in row8 the digit 1 I get as a result in r8c7 also the digit 3 which cannot be true.
So what do i wrong.
Regards
Erny
Erny, you can’t take columns 4 and 9 into consideration. You can only take those columns where your chosen digit (in this case number 1) falls into ONLY 2 rows! In column 9 you have number 1 in 3 rows so it’s not good.
In columns 4 and 7 you have number 1 in only two rows – in rows 4 and 8. In this case, you can apply the X-Wing.
Thanks dj
erny
perhaps you could elaborate more on the swordfish method?
thanks alot
don, i made a post in which i did elaborate on the swordfish technique.
If you have any questions about it, please post them as comments to that article.
Swordfish explanation can be found here:
http://www.djape.net/2006/03/23/swordfish-solving-technique-explained/
how do u design the sudoku puzzles?
i have read the swordfish ‘n’ times and still do not get it.
please let me know how to be illuminated !!
thanks, anu
I do NOT get this X-Wing thing or why you choose to pick the numbers you pick. HELP!
Diane,
pay close attention to the puzzle and to all the numbers that have been penciled-in.
Basically, you are looking for pencilmarks of the same number (in this case “1”) that form a rectangle. However, it can’t be any such rectangle, it must be one where there aren’t any other occurences of that same number (“1”) in the columns that correspond to that rectangle.
Look carefully, focus on the numbers and think about it… first time it takes a while until you see what’s going on.
Good luck!
your explanation of swordfish makes no sense!. what about R3C8,R3C9,R8C8,R8C9. or R4C5,R4c9,R6C5,R6C9.
I think I can help put things into perspective. The swordfish is an extension of the X-wing, and the pattern can be continued, although that’s probably useless with a 9×9 grid.
The main step to this process, once you’ve reached an impass, is to look for X number of columns that have X and only X number of rows with that number (go in sequence to make it easier, so we start with one). NOTE: With the X-wing you will have a total of four numbers. With swordfish and beyond, you only need to have X unique columns and X unique rows. Swordfish needs a minimum of 6 numbers I believe arrayed as below (numbers are at the X’s).
-xx
x-x
xx-
What follows is a look at each column to determine how you’d analyze them to see if they’d work. This is a lower level analysis, swordfish’s and above can come in more complex forms and are not thought about here. Give it time, you’ll get them.
C1 – A lone one. This would technically match the pattern, X columns with X rows, but since X is one, then the dot-wing solves itself.
C2, 3, 6 – These have been solved already.
C5 – There are four 1’s in this column. We would need to examine the other columns to see if there are three of which that also have four 1’s in the same rows. As we can see, there is one other column with four. It’s not enough, so let’s continue.
C8 – This is the other column mentioned from above.
C9 – This column contains three 1’s, since it’s the last, there’s no luck.
One last thing to consider, Since this is nothing but a grid, you can work the same process, but begin with the rows, and then check the columns. In this instance, there appears to be a second x-wing with 1’s in the following cells: C5R6, C8R6, C5R9, C8R9.
I hope this helps people, unless I misunderstood something, in which case I’ve probably confused more people.
Thanks everyone, and DJ, great site.
Kremnari
I don’t understand this technique, as well as the Swordfish technique. Can you please explain both of these techniques to me?
mme..too…nosebleed…..
When you are selecting columns and rows, can the columns or rows be in the same group of 3’s or next to each other. Not using the above numbers, but perhaps C1R4, C1R6, C3R4, C3R6 or even C1R1, C1R3, C2R1, C2R3?
I would assume that this also works with Samurai Sudoku, as long as I stay in one of the 5 sets of 9.
Thanks
I have some logic problems with your x wing solution. To me it is no different than guessing which numbers to drop out when you get the use the x wing. You are choosing randomly since if you make the other choice the puzzle may fail but because the original premise had no logic. I appoligize that I cannot explain it although I have failed to logically solve puzzles because I would not make the assumption you require.
Really appreciate the explanation of the technique – I can remember times when I’ve been stuck and it’s clear to me now that X-Wing could very well have been the key! Anyway, I’m generally quite good at putting things simply, so let’s hope that’s the case and I can maybe explain a little more clearly.
OK. So in the example, you look down column 4, and see that a ‘1’ can only be placed in either row 4, or row 8. And you look down column 7 and see that again, a ‘1’ can only be placed in one of these 2 rows, 4 & 8. Think of it as a situation where you could draw a perfect box or rectangle by connecting the ONLY 2 cells from 2 columns which can contain a given number.
Now, here’s why it works – If the ‘1’ in column 4 is in row 4, then the 1 in column 7 can’t be in row 4, and must be in the only other possibility, row 8. Or vice versa – the 1 in column 4 in row 8, so the 1 in column 7 must be in row 4. We can’t actually determine that for now, but that doesn’t matter.
The point is, to complete these 2 columns, we’re going to have to take care of the ‘1’ for both of the rows. So anywhere else on those 2 rows which had 1 as a possibility, we can rule out.
And naturally, it’d work just as well to find the rectangle by connecting the only 2 possible locations of a number on each of 2 rows.
The important thing is just that THE ONLY TWO possible locations on one row (or column) line up with THE ONLY TWO possible locations on another. Hopefully, the number will have plenty of other possible locations along each of these lined-up columns (or rows) for us to eliminate – it’s only important that there is ONLY TWO along the axis we’re focusing on, and that they line up.
Reading it back, I’ve no idea if that’ll be at all clearer. Here’s hoping!! But for me, having totally understood X-Wing, it was only a minor step to click on the concept for Swordfish as well, so hope this helps.
Keep up the good work!
Gostei muito das dicas sobre como resolver um sudoku e agradeço, porém, não compreendi as tecnicas “X-Wing e Swordfish. Seria possível obter uma explicação mais detalhada e com exemplo concreto?
Há mais alguma técnica para se resolver sudoku diabólico?
Agrdeço muito.
Antonio Videira.
3 Trackbacks
[…] Well, to proceed further, you must learn another technique – “X-Wing”. I’ve already explained that in detail before. […]
[…] A while ago I explained the X-Wing solving technique. Recently I shown my explanation of other basic, Classic Sudoku solving techniques. […]
[…] X-Wing Technique […]