This is the archive of the old posts from Djape .Net, more or less as they used to be. Please go to djape.net to see the new website.

Swordfish

A while ago I explained the X-Wing solving technique. Recently I shown my explanation of other basic, Classic Sudoku solving techniques. The only remaining solving method that I don’t consider trial and error is Swordfish. So, to complete the list of Sudoku solving tips, here is an example of a Sudoku puzzle that can be solved using Swordfish. Here is the puzzle: Swordfish puzzle This is how far you can get without using Swordfish: Swordfish puzzle After you pencil-in all the numbers, you focus on number 4 and you look at columns 1, 5 and 7. In those 3 columns, number 4 appears altogether in precisely 3 rows: 1, 7 and 8. So, 3 columns with candidates in only 3 rows, it follows that (since each number can appear only once in each column and each row) number 4 can be eliminated from rows 1, 7 and 8 except from those cells that belong to columns 1, 5, 7. In other words, number 4 appears in precisely 3 cells from those 7 that I highlighted with a red rectangle. Of course, those 3 cells must be in different columns/rows, but the point is that in rows 1, 7 and 8 number 4 cannot appear in any other cell. This indirectly solves R1C8 – because it can’t be 4 the only other option is 7. I hope this makes sense. Download the final solution. Download the text file to import to Perfect Sudoku.
This entry was posted in Solving tips and tagged , , , , , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

33 Comments

  1. leigh bainbridge
    Posted April 1, 2006 at 4:07 pm | Permalink

    i cant see how this works – there are other rows and columns with 4 in them – why do you only look at those particular ones?

  2. Posted April 2, 2006 at 12:59 am | Permalink

    leigh, I suggest you to first try to figure out how X-Wing works. It can be found here: http://www.djapedjape.com/?p=98

    After that, you must realize that Swordfish is just a more complex version of X-Wing.

    Basically, you are looking for 3 columns with a certain number as a candidate in PRECISELY 3 rows ALTOGETHER (or vice versa). This can be difficult to spot – you need to practice. And yes, there are other rows/columns with number 4 as a candidate, but those 3 that I indicated are the only ones that fulfil that condition – 3 columns with candidates in only 3 different rows.

  3. leigh bainbridge
    Posted April 3, 2006 at 8:14 am | Permalink

    Gotcha – cheers

  4. don
    Posted April 4, 2006 at 2:10 pm | Permalink

    i’m sorry but please could you explain more about the swordfish method to me, i understand the x wing technique however i do not get this swordfish technique

  5. Jolecia
    Posted February 12, 2007 at 4:56 am | Permalink

    i the x-wing strategy but i dont understand how in the swordfish there are three fours in a column i thought that there could only be two in a column but there are three and this confuses me

  6. Valentina
    Posted May 26, 2007 at 7:14 pm | Permalink

    I don’t understand this technique. Can you please explain it to me?

  7. Skruffs
    Posted July 28, 2007 at 5:05 am | Permalink

    The number 4 has to appear only once in each column – three columns have the number 4 appear once in three rows Tops
    Sicne each row and each column can only have one 4, those intersections are the only options for 4. Three 4s equal one for each column, which means one for each row – so any 4s not at an intersection on those rows/columns, isn’t possible, because it would prevent those columns from being able to have their 4s.
    Hope that works.

  8. larjoranj
    Posted August 26, 2007 at 8:54 am | Permalink

    In this example they picked number 4. So we need 3 columns where the number 4 only appears in 3 rows. In this example we have columns 1,5 and 7. In column 1 the # 4 appears in row 7 and 8. In column 5 the # 4 appears in row 1 and 8. In column 7 the # 4 appears in row 1, 7 and 8. So, for our 3 columns (1,5,7) the # 4 ONLY appears in 3 rows total (1,7,8). There are 4’s in other columns. Take column 7,8 and 9 for example. There are 4’s in all 3 of those columns. Now, if there are 4’s in ONLY 3 rows of these columns, it will work. Let’s take a look. In column 7 there are 4’s in row 1,7 and 8. In column 8 there are 4’s in row 1,3 and 6. And in column 9 there are 4’s in row 6 and 9. So in columns 7,8 and 9 we have #4 appearing in rows 1,3,6,7,8 and 9. That’s 6 different rows. That won’t work. Look for a number that appears in 3 different columns (up and down) and ONLY 3 different rows (across) in those columns. I know this got way too long but I’ll point out another example of the 4’s that won’t work. Columns 1,4 and 5 all have #4’s in them. Column 1 has 4’s in row 7 and 8. Column 4 has #4’s in rows 3,8 and9. Column 5 has #4 in rows 1 and 8. So, between the 3 columns (1,4,5) they have the nummber 4 appearing in rows 1,3,7,8 and 9. That’s 5 different rows and that won’t work. Remember, a number that appears in 3 different columns AND ONLY 3 different rows in those 3 columns. I hope everybody is confuseder than before.

    • sunil
      Posted October 5, 2012 at 12:16 pm | Permalink

      Nice explain.It helps me to remove confusion about sword fish method somewhat….

  9. Pat
    Posted August 28, 2007 at 11:46 pm | Permalink

    How do I find the solution for the Washington Post Samurai Sudoku for 8/26/07?

  10. Posted August 29, 2007 at 9:33 am | Permalink
  11. Jim B.
    Posted December 3, 2008 at 8:28 pm | Permalink

    djape, what you and skruff say makes sense, BUT, column 1 and 5 only have #4 two times! I see the dates on here are kind of old, does anybody even read this anymore? I’d really like to understand the swordfish technique. I’ve been giving up becuase I thought we had to resort to guessing.

  12. Posted December 3, 2008 at 8:45 pm | Permalink

    Jim, yes, columns 1 and 5 have #4 twice only, but what’s important is that 3 columns (1, 5 and 7) have it in precisely 3 rows.

  13. Posted December 3, 2008 at 8:51 pm | Permalink

    One other suggestion: try looking at it backwards!

    So, lets say that R1C8 = 4. This eliminates 4 from R1C5 and R1C7. Fine. Now, look at R7 and R8 and C1, C5 and C7. There are 3 columns, each one of them needs a 4 somewhere, so we need three #4s. As it happens, all candidate cells for #4 lie on 2 rows, R7 and R8. Since two rows can hold #4 only twice, this becomes impossible!

    Therefore, our initial guess that R1C8=4 was wrong.

    This what I just explained is of course trial&error. Swordfish helps you avoid that by logically deducing that R1C8 cannot be 4.

  14. Jim B.
    Posted December 4, 2008 at 4:37 am | Permalink

    I’m not getting it -it’s probably me, but you agreed that C-1 and C-5 have #4 in only 2 rows, then you say C-1,5,+7 have it in “precisely” 3 rows -unless by “precisely” you mean before you solved C-1/R-9, and C-5/R-9, they had a possible #4….?

  15. Jim B.
    Posted December 4, 2008 at 5:24 am | Permalink

    By the way, where are you guys,the middle-east? It’s about 10:24 here.

  16. Jim B.
    Posted December 6, 2008 at 4:27 am | Permalink

    djape, I don’t get it , you answered me in 17 minutes last time. It’s been a couple days. What kind of schedule you got man?
    -Still confused
    -Jim

  17. Posted December 7, 2008 at 4:12 pm | Permalink

    Jim:
    C1 and C5 have #4 in 2 rows.
    C1, C5 and C7 have #4 in 3 rows.

    Not sure what the problem is? You have $5 in your left pocket, you have $10 in your right pocket. But you do have $15 in those two pockets, right?

    If you still have questions, I think the best place to find an answer is in the forum: http://www.djapedjape.com/sudoku/forum

  18. Lynn
    Posted October 9, 2009 at 9:54 am | Permalink

    I know the Swordfish subject has been beat to death, but there are still a few “rules” that I would like to have clarified. I have seen numerous examples using three pairs of numbers (N) in three rows (to eliminate some N’s in their columns), and they all make perfect sense, especially when all the columns are linked (conjugal) pairs or are perfectly aligned, and there are no “missing” numbers (N) in the initial row(s)…and likewise when starting with columns for eliminating in rows. I have also seen several examples of three sets of three numbers in three rows, all perfectly aligned with three rows. It starts getting a little confusing when the row/column intersections are not perfectly aligned to form a box and when the sets of numbers are not exactly the same in each row, such as when a set of three numbers is used in one row, while two numbers are used in another row, such that one set of numbers forms an extension (“sword”) outside the box formed by the other two sets of numbers. Here is an example of a POSSIBLE application, where it’s hard to tell if all the as-yet-unwritten rules are being met…and where, perhaps, a few written more rules can be expressed to help everyone better understand how to apply the Swordfish strategy (In this case N=6):

    Col:123 456 789
    R1 xxx x6x x66
    R2 6xx 66x xxx
    R3 6xx x6x x66
    (The center rows have no 6’s)
    R7 xxx x6x x66
    R8 xxx 66x xxx
    R9 xxx xxx xxx

    With all these 6’s aligned in rows and columns, it sure looks like there should be a way to build a Swordfish. However, if there were a rule stating that an entire row can contain no more than three numbers (N), then R3 in the example would be ignored.

    If we try to use R1, R2 and R7 as a Swordfish (ignoring R3), we can see that only one number in R2 (the 6 in C5) lines up within the 3 required columns, C5, C8 and C9. If this won’t work (and why can’t there be two numbers “missing” or already solved in the row?), there should be another written rule stating that each of the three rows must have either two or three numbers (N) present within the Swordfish. This brings up another question and possible rule: Do ALL of the numbers (N) within a row have to be used, or can some be excluded from the Swordfish, for example by using 2 out of 3 of the numbers (N) possible within any given row?

    To satisfy all these new rules, none of the rows seem to work as a Swordfish, so next we look at the columns. C5, C8 and C9 MAY form a Swordfish with R1, R3 and R7, depending on whether or not the earlier “rule” must be applied, that is that C5 has too many numbers (in this case the 6 in C5R2). The other possible Swordfish is in R2, R3 and R8, intersecting with C1, C4 and C5 (or vice versa), but it, too, may be killed by these added rules.

    [Obviously, these rules would also apply when starting with columns.]

    Your comments would be very much appreciated, as I am just getting started with Sudoku…and loving the frustration of trying out the harder puzzles! Thanks in advance.

    Lynn

  19. Joseph Ruffino
    Posted November 12, 2009 at 8:23 pm | Permalink

    Where can I find the reply to Lynn’s question? I love the question?

  20. Patrick
    Posted January 16, 2010 at 5:31 pm | Permalink

    There is also an X-Wing. The X-Wing is r4c2 r4c7 r7c2 and r7c7. Eliminate 9s from r2c7 r8c2 and r8c7. Also an XY-Wing r7c1 r7c6 and r8c5. Eliminate 4 from r8c1. I use a piece of software which is helping me learn these techniques. Any one that is interested in knowing which software program, then just reply to this comment and I’ll set up my own site with the link. It will be an affiliate link but if its helping me to learn then I know it will help you. Thank You.

    • bill
      Posted June 4, 2013 at 6:14 am | Permalink

      hi Patrick
      I’d like to see that software

  21. June
    Posted January 26, 2010 at 5:55 pm | Permalink

    I understand swordfish, but to tell the truth,
    I was able to solve this puzzle very fast without using that method.

  22. Doug
    Posted March 12, 2010 at 6:33 pm | Permalink

    Hi Patrick. Could you let me have that link? Thanks.

  23. Janice
    Posted June 15, 2010 at 10:00 pm | Permalink

    I only have one question about the swordfish. Am I correct in assuming that two of the rows (or columns) cannot be in the same region? For example, you could not have a number four in C1R3,5&6, C3R1,3&6 and C4R1&3. This would meet the qualifications of (1)no more than three of the candidates in a row or column and (2) all candidates confined to only 3 rows and 3 columns. However, two of the columns are in the same region (Left Region) and two of the rows are in the same region (Top Region). Therefore, this would not work. Correct? Thank you.

  24. Janice
    Posted July 12, 2010 at 9:39 pm | Permalink

    It’s me again. It has been a month and I have not received an answer to my question on June 15th. I would appreciate having your input. In addition, (see what happens when you tarry?), I have another question. If one region has more than three of the candidate numbers in it, is that like having more than three candidates in a row or column, making any of the numbers from that region off limits? Both of my questions involve the regions. All tutorials I have read only address the columns and the rows and their limitations or requirements. I sure hope I am making myself clear. I await your reply.

  25. Dean
    Posted September 23, 2010 at 8:52 am | Permalink

    I finally got it from scruffs explanation!!!!!
    So if you start at column one, there are two rows with 4’s in them.

    Skip columns 2 and 3 because they are already solved.

    Next go to column 4, it has 3 rows with 4’s in them. So if you look at column 1 and 4 only and add up the amount of rows that have 4’s in them for these two columns only, it would be more than three rows. (therefore cannot use columns 1 and 4 together)

    Move on to column 5. It has 2 rows with 4’s in it. One of the rows is shared with column 1. One of the rows isn’t shared with column 1. We have a second candidate for the swordfish.
    column 1 and column 5 combined have 3 rows that contain 4’s.

    Column 6 is already solved.

    Column 7 has three rows that have 4’s in them. These three rows are the same rows that column 1 and column 5 also have 4’s in.

    We have a swordfish, and do not need to look any further.

    OK. Now that I am convinced that I understand it. Can some of you Sudoku guru’s confirm with me that I have understood it correcty?
    Thanks

  26. Dean
    Posted September 23, 2010 at 9:24 am | Permalink

    Now I can also see why other 4’s can be eliminated.

    Assumption 1:
    If we assume that R1C5 is a 4, then no other 4’s in Row 1 can be 4.
    Since we still need to have a 4 in column 7, then the only options would now be R7C7 and R8C7.
    It is also a fact that Column 1 must have a 4 in it, and the only place for a 4 in column 1 is R7C1 and R8C1.

    This scenario would make it impossible for R8C4 to have a 4 in it.

    Assumption 2.
    If the first assumption was wrong. Then the only other option for column 5 would be R8C5.

    In either case it would be absolutely impossible for R8C4 to have a 4 in it.

    R8C4 can have the 4 eliminated in either scenario! Therefore it must be removed.

    The same logic can be used to eliminate other 4’s.

  27. Amy Cobb
    Posted January 25, 2012 at 11:13 pm | Permalink

    I hope you never quit! This is one of the greatest blogs Ive ever read. Youve got some mad skill here, man. I just hope that you simply dont lose your style since youre definitely among the coolest bloggers out there. Please keep it up simply because the world wide web needs a person like you spreading the word.

  28. Crash
    Posted February 19, 2012 at 9:11 am | Permalink

    Looks like you’re forming a “L”or a right angle with 2 “x wings” .

  29. Charity
    Posted March 24, 2012 at 8:54 am | Permalink

    What I don’t understand is when you penciled in possibilities it seems like you missed some R5C9 could be a 4 but you didn’t pencil that in which would ruin your swordfish. maybe I’m missing something, could someone please explain?

    • Posted March 25, 2012 at 6:53 am | Permalink

      Charity, R5C9 cannot be a 4 because R5C6 = 4, so there is already a 4 in row 5.

  30. bob
    Posted November 11, 2012 at 7:25 am | Permalink

    the rows contain more 4s in them and ur 7th coulomn has 3 4s ,, how did u exactly chose them ,, and they say that sword fish must form a loop ,, i cant see how u can form a loop in ur game !!

    thank u 🙂 .

One Trackback

Post a Comment

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*
*

This site uses Akismet to reduce spam. Learn how your comment data is processed.

eXTReMe Tracker