News and Updates on X
SudokuWiki.org
Strategies for Popular Number Puzzles

Swordfish Strategy

With X-Wings we looked at a rectangle formed by four numbers at the corners. This allowed us to exclude other occurrences of that number in either the row or column. We can extend this pattern to nine cells and achieve even more eliminations.


A Swordfish is a 3 by 3 nine-cell pattern where a candidate is found on three different rows (or three columns) and they line up in the opposite direction. Eventually we will fix three candidates somewhere in those cells which excludes all other candidates in those units.

The shaded cells show the Swordfish where X is unique to three cells in columns 2, 4 and 6. They are aligned on rows A, C and F. This means we can remove all candidate X in the other positions on those rows.

X-Wing inside a Swordfish
X-Wing inside a Swordfish

If you are not convinced that the shaded cells really must contain the solutions we can argue this way. All Swordfishes will break down into X-Wings and because we know X-Wings work, so will the Swordfish.

Take this arrangement of candidate A and let’s pretend that E6 is the solution. We ‘remove’ the rest of A in column 6 and row E. That leaves a X-Wing in AC24.
Another way to cut it
Another way to cut it
If that works for E6, let’s try another cell. Pretending C2 is a solution we remove the rest of A in row C and column 2. Again we get an X-Wing.
So all cells in the 3 by 3 grid are ‘locked’ together.
Perfect 3-3-3 Swordfish
Perfect 3-3-3 Swordfish : Load Example or : From the Start

To match theory with practise the first example is a perfect 3-3-3 Swordfish, so called because all three candidates in each column are present (that is, no solved 8s in the pattern). The green numbers are the Swordfish cells. The yellow numbers are those cells where 8 can be removed.

A perfect Swordfish is extremely rare. This one is provided by Klaus Brenner who found it in the newspaper La Libre Belgique. (Turn Rectangle Elimination off)
If you remember how Naked and Hidden Triples work you'll remember that they require three numbers in three cells - in total. It's not necessary for every number to be in all three cells. So it is with the Swordfish.

Swordfishes come in a number of variations depending on the number of X present in the nine cells that make up a Swordfish. With an X-Wing you need candidate X in all four cells of the 2 by 2 formation, but with the 3 by 3 Swordfish formation you don't need X in every cell - just as long as it is spread out over 3 by 3 cells. The next example has 9 twice in each column and is called a 2-2-2 Swordfish.



Swordfish Example 1
Swordfish Example 1 : Load Example or : From the Start

This is a 2-2-2 formation Swordfish in the columns and eliminates in the rows. I have labelled the three pairs AA, BB and CC which form each "2" in the name. Notice how they are staggered so that they still cover three columns. This is a minimal Swordfish but it does the job. We have six 9s that can go in one swoop.
(Turn Rectangle Elimination off)
Swordfish example 2
Swordfish example 2 : Load Example or : From the Start

This second Swordfish is orientated in the opposite direction and we eliminate in the columns.

A Swordfish can be referred to by combining the row and columns numbers, which makes this example CDJ379. In formation terms it is 3-2-3.

(Turn Rectangle Elimination off)

Swordfish Exemplars

These puzzles require the Swordfish strategy at some point but are otherwise trivial.
They make good practice puzzles.
3, 4 and 5 are made by Klaus Brenner



Comments

Your Name/Handle

Email Address - required for confirmation (it will not be displayed here)

Your Comment

Please enter the
letters you see:
arrow
Enter these letters Remember me


Please ensure your comment is relevant to this article.
Email addresses are never displayed, but they are required to confirm your comments. When you enter your name and email address, you'll be sent a link to confirm your comment. Line breaks and paragraphs are automatically converted - no need to use <p> or <br> tags.
CommentsTalk

... by: kavalasax

Wednesday 31-Jul-2024
In some of the Exemplars above, you need to turn off Rectangle Elimination in order to require Swordfish for a solution.
I wonder if they are somehow related ?
Andrew Stuart writes:
Rectangle Elimination has blown a big hole in my documentation. Need to go through all the examples and find new ones if they won't appear anymore with RE turned on.
Add to this Thread

... by: RustyRaven

Friday 15-Dec-2023
I think I have a situation where I have a swordfish (AEJ246) but the candidate number ultimately lies outside the 3-3-2 grid. Could you explain why that is? Here is the puzzle, solved up to the point of the swordfish: [ 901070346 370004051 645003007 510049768 407080519 896700423 200400105 104000002 750030604 ]

Using the solver, I do see that there is a box/line reduction that occurs before. But why would that negate the premise of, "the shaded cells really must contain the solution"?
REPLY TO THIS POST

... by: Carman847

Saturday 17-Mar-2018
Can swordfish include more than 3 rows/columns ?
Andrew Stuart writes:
Yes, a 4 x 4 version is called a JellyFish. Higher than 4 does not apply for the reason that a 5 x 5 automatically creates a 4 x 4 with the remaining numbers.
Add to this Thread

... by: William Drabkin

Thursday 28-Dec-2017
This is the clearesst explanation of the swordfish strategy I've yet seen, in particular that that the digit on which it hinges can appear in as few as six and as many as nine squares.
REPLY TO THIS POST

... by: Wondereally

Saturday 2-Apr-2016
I do number puzzles because I am color blind. So here it is in all infinite wisdom and knowledge explaining the tactics with colors. Just sayin "YO"!
REPLY TO THIS POST

... by: Pete Willetts

Thursday 11-Feb-2016
Hi Andrew

My compliments on the site. Please ignore my previous comment. There is indeed a swordfish pattern for the possible value 2 but it doesn't eliminate anything. Indeed I found several swordfish patterns in the example similarly.

I was using the example to test code in a solver that I've written. There were lots of print statements to show what was happening. The code was reporting eliminating possible values when it hadn't. D'OH! Which led me to think I'd found another valid swordfish.

Regards
Pete
REPLY TO THIS POST

... by: Wambugu

Thursday 21-Jan-2016
Concerning example 2 on why You did not use rows E,F and G,was that they contained more than three 4s.
That being the case,on example 1 why did you use the last row yet it contains more than three 9s.
Also on your perfect swordfish example,why do rows B,C&D contain more than three 8s
kenya
REPLY TO THIS POST

... by: Morris

Thursday 21-Jan-2016
In example 2, You said you did use rows E,F and G. Because they had extra 4s. My question: in example 1 why did you use row B, yet it has extra 8s
Andrew Stuart writes:
Example one is orientated on the columns. That is, the three columns contain 3 or less 8s. We eliminate the surplice 8s in the rows - in this orientation of a SwordFish.
Add to this Thread

... by: resat

Friday 20-Nov-2015
thx i understood this issue in your page .
REPLY TO THIS POST

... by: Confused

Monday 27-Jul-2015
In sword-fish example 2, why did you use Rows C and D in the pattern and not Rows E and G?
Andrew Stuart writes:
Rows E, F and G contain more than three 4s in each row
Add to this Thread

... by: Sukjae Yu

Saturday 14-Mar-2015
Hello;
I am not in a position to comment. And it is not my intention. I am just learninin . But, when I found your site, I felt blessed. It is just what I have been hoping for. It is excellent. You are genius. I only wish to understand a better part of what you are trying to impart.
Best Regards
Sukjae Yu
REPLY TO THIS POST

... by: G

Monday 25-Aug-2014
I'm still a bit confused. In a 2-2-2 Swordfish what do I look for that signals this is the method I should be using? Once identified, how do I confirm my results?

PS-I love the solver. I use it to "cheat" when I get stuck with the app on my phone. You taught me how to do an X-Wing by eye and I love it!
REPLY TO THIS POST

... by: KeithD

Wednesday 22-Jan-2014
Unsurpassed site; many thanks. I'm definitely learning from it - I just used my first swordfish (3-3-2) to solve a newspaper puzzle.

I'd like to reiterate Pieter's point about the potential for confusion in the write-up of the 2-2-2 example.The sentence "The next example has 9 twice in each row and is called a 2-2-2 Swordfish" strongly suggests, twice, that the swordfish is in the rows, and the reference in the following paragraph to the pairs (visibly in the rows) that are "staggered so that they still cover three columns" reinforces this. Even though the colours in the diagram show that the swordfish is in the columns, it is still initially confusing - the more so because it would be a 2-2-2 in either orientation. I have to wonder whether the example has been reoriented at some stage during development.

An initial fix would be to change "rows" to "columns" in the quoted sentence. Beyond that, I cannot see what is gained by the comment that it "reduces to three pairs", when other 2-2-2 examples could "reduce" to various combinations of 3-2-1. I don't recall you saying anything similar anywhere else and it would, I think, be clearer just to say, as you normally do and as you do in the example that follows, that the swordfish is in the columns and the eliminations take place in the rows.
Andrew Stuart writes:
Hi Keith, thanks for reminding me I needed to fix this example. I've done so now and re-worded the paragraph. Very glad you are enjoying the site!
Add to this Thread

... by: nono

Wednesday 20-Feb-2013
in the first pattern with the Xs, is it no possible to have other swordfishs with columns 2,3,4 or 2,3,6 or 3,4,6 ? why can we not work with the 2 X in column 3 ?
swordfishs will then be 3x2x3 and no 3x3x3.

merci d'avance pour la réponse
Andrew Stuart writes:
I reduced the diagram to a simpler state to illustrate the pattern but I can see that could be confusing. I'd taken off the bottom two rows and only put in sufficient Xs to show one pattern but on its own, yes, other sword fishes are possible. So I have now replaced the old diagram with a full one. Refresh the page.
Add to this Thread

... by: jim

Wednesday 5-Dec-2012
Since the 222 combination works in the swordfish. Does a 332 or 322 combination also work?
Andrew Stuart writes:
Yes, all available 3s and 2s combinations
Add to this Thread

... by: Pieter, Newtown, Australia

Thursday 16-Feb-2012
To expand on Eric's reference to locked pairs (2011-12-2), and using the perfect 3-3-3 formation I think a different and simpler way to describe a Sword-Fish is that it is "A locked set of 3 locked-triples (sharing the same 3 rows and same 3 columns)".

The simplest 2-2-2 formation in Example 1 is "A locked set of 3 locked-pairs (sharing the same 3 rows and same 3 columns)". And as Jef points out, boxes can also be involved (if there is a locked pair linking with the other locked pairs/triples)

Also re Example 1, I think your labelling is confusing Andrew! Yes it reduces to AA, BB and CC, but to detect the Sword-Fish, the 3 pairs of 9's one needs to find are in Cols 2, 5 & 8 labelled BC, AB & AC.

Still the BEST Sudoku site on the net!
REPLY TO THIS POST

... by: Eric

Monday 12-Dec-2011
I think my previous comment was a bit off-topic, since I explained X-Cycle here. This was caused due to the fact that a 2-2-2 swordfish is an X-Cycle as well.

I would like to suggest that this topic starts of with the 3-3-3 Swordfish to fully explain this subject and then focus on 2-2-2, 2-1-2, etc.

I also see great simillarity with naked pairs/triples and quads and wonder if swordfish detection for more than 3 rows or columns is useful.
REPLY TO THIS POST

... by: Eric

Friday 2-Dec-2011
I think the Swordfish pattern becomes visible by connecting cells A-C, B-E and D-F. This shows 3 parallel lines that show some similarity with a Swordfish.

The Swordfish method can be explained as follows:
Statement:
Number 5 is either in the cells B+C+F or in cells A+D+E.
Proof:
- If cell B would contain numer 5, then cells B and D cannot contain 5. Therefore, on row F, cell C must contain a 5 (single candidate), and at row J, cell F must contain a 5 (again: single candidate).
- If cell A would contain number 5 than cell D+E must contain a 5 for same reason.
- At row A, number 5 can only be filled in at cell A or B, and therefore, number 5 must be present in cells B+C+F or in cells A+D+E.

Based on this statement, the pairs CE, AF and BD are locked pairs as well. Since number 5 must be in cell C or E on column 2, cell X cannot contain number 5. In column 5 cell A or F must contain number 5, and at column 9 cell B or D must contain number 5. Number 5 can thus be removed from all other cells at these columns.

Next to pairs CE, AF and BD, the following pairs are also locked pairs: AC, BE, DF.
These locked pairs are not valuable for the Swordfish strategy, but (in my opinion) these locked pairs represent the Swordfish pattern and gave name to this strategy.

REPLY TO THIS POST

... by: WLP

Monday 4-Jul-2011
Re: Swordfish. Are there clues to "find' the Swordfish number? Your top/first example highlights 5 at c1, d4 and h8, and the Swordfish is based on the 5s elsewhere. Is there some significance for this? (Of course, the bottom/last example doesn't follow this approach.) I see the usefullness of this technique but spotting the correct number is difficult. Thanks!
Andrew Stuart writes:
Easiest way it to highlight the each number in the solver and see if you can spot a 3-3-3 pattern in rows or columns. 3-3-3 can mean less than 2 as well, as long as you can spot a 3x3x3 grid overall. You'll also be looking for 2x2 X-Wing and you should use those first. So you're looking for the minimum number of X in one dimension and an excess of X in the other.
Add to this Thread

... by: Prasolov V.

Wednesday 20-Apr-2011
I've got new ideas for me from this site. Thanks. But you would have more simple methods, and then last example would disappear, such as "Perfect 3-3-3 Swordfish". You have many hard strategies but you have little simple methods. It is not logical.
REPLY TO THIS POST

... by: JK

Wednesday 2-Mar-2011
Very good explanation, but could you add some more examples including the other possible Swordfish formats, 3-2-1 etc?
REPLY TO THIS POST

... by: lec

Monday 28-Feb-2011
Re: Swordfish strategy page formatting - the characters in yellow on print version of web page are printing in a light yellow, making them nearly invisible. They are not formatted the way yellow characters on your other strategy pages are (dark blue with yellow highlighting). Nit-picky, I know. (I'll save the kudo until I've actually read the pages, but predict that you deserve many. Hope this makes sense; I'm wiped at the moment, and apologize for not hunting down appropriate address for this comment.)
REPLY TO THIS POST

... by: p davis

Friday 3-Sep-2010
my comment refers to Jef's mixed Box/Row example:

any wrapped AIC chain eg.
{a = b - c = d - e = f} - a implies a 'fish'. But as far as spotting patterns and associated eliminations (swordfish in rows, eliminations in columns) it doesn't seem particularly useful, except in theory to extend the definition of SwordFish'.
Your example is:
{r9c3 = r9c4 - r78c6 = r23c6 - r1c45 = r1c3} - r9c3.
this wrapped AIC chain eliminates all non-fish candidates in columns 345.
It's just a structural coincidence that the eliminations all occur in those columns here (so I guess you could technically call the pattern a swordfish).

BTW: a Finned X-Wing is a 2 string Kite is a simple AIC chain:
a = b - c = d, where the geometry of the chain is constrained to a rectangle with a 'group' node in one corner.
REPLY TO THIS POST

... by: Trev

Thursday 6-May-2010
If you had a swordfish with a single cell in it's row (i.e. X-X-1), wouldn't that single cell be a hidden single and therefore you wouldn't need to use the swordfish strategy?

Awesome site by the way!
Andrew Stuart writes:
Its not about finding the solution to any one part of the sword-fish itself, its about eliminating candidates outside the swordfish. The '1' in the formation would be a given solution yes, for that cell: we are just reusing it to get something else.
Add to this Thread

... by: CS VIDYASAGAR

Thursday 25-Feb-2010
An excellent exposition of really advanced and difficult techniqe which many find it difficult to understand. You explained in simple and easily conprehendible manner. Thanks. Now I am confident of solving extremely difficult Sudoku puzzles using sword fish technique.
REPLY TO THIS POST

... by: jef

Thursday 9-Apr-2009
A Swordfish is not limited to rows and columns, also boxes can be involved:

. . x|x x .|. . .
. . .|. . .|. . .
. . .|. . .|. . .
-----+-----+-----
. . .|x . .|. . .
. . .|. x .|. . .
. . .|. . .|. . .
-----+-----+-----
. . .|. . .|. . .
. . .|. . .|. . .
. . x|x . .|. . .

Swordfish row 1, box[2,2] and row 9.
Is your solver finding this pattern?
Have you examples of this pattern?

Kind regards,
Jef

PS I totally agree with your remarks on J.F. Crook's paper, nothing new and not a real solution.

http://users.telenet.be/vandenberghe.jef/sudoku/
REPLY TO THIS POST
Article created on 11-April-2008. Views: 771341
This page was last modified on 27-December-2014.
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-2024