Swordfish in Sudoku: three rows, three columns, one digit
What you are looking for
Pick one digit and look only at its pencil marks. A Swordfish needs three rows in which that digit has two or three possible squares, and all of those squares have to fall inside the same three columns. Those three rows are the base of the fish. The three columns are where the eliminations happen.
If you already know the X-Wing, this is the same move with one more line on each side. The HoDoKu solving guide puts it this way: a Swordfish works like an X-Wing, only with three base sets and three cover sets instead of two. You can also turn it the other way: three columns whose candidates sit in the same three rows, with the cut made along those rows.
One detail trips up many players. A row in the fish does not need the digit in all three columns. HoDoKu notes that not every crossing of a base line and a cover line has to hold the digit, but each of the six lines has to hold it at least once. SudokuWiki names the shapes by how many candidates each line has: a "3-3-3" fish fills all nine crossings, while a "2-2-2" fish has only two per line. SudokuWiki calls the full 3-3-3 version extremely rare, so expect a mix of twos and threes.
Why it works
Each row has to contain one 9. Take rows 4, 5 and 9 from the board above. Every square where those rows could put their 9 is in column 2, column 4 or column 9. So the three 9s for these rows will all land in those three columns.
They cannot share a column, because a column holds only one 9. Three 9s, three columns, at most one per column: each of columns 2, 4 and 9 gets exactly one of them. That means the 9 for column 2, the 9 for column 4 and the 9 for column 9 all come from rows 4, 5 and 9.
Now look at any other square in those three columns, say row 6, column 4. If it were a 9, column 4 would already have its 9 from outside the fish, and one of the three rows would have nowhere left to put its own. So that square cannot be a 9, and the same goes for every square in columns 2, 4 and 9 outside rows 4, 5 and 9. You never need to know which row takes which column.
SudokuWiki offers a second way to convince yourself: imagine any one of the fish squares is the 9, cross out its row and column, and what is left is an X-Wing. Both arguments arrive at the same cut.
A worked example on a real board
This board is not one the game serves. It is a random board with one solution and 24 givens, seed 2904, made by the generator behind this site. We let the solver run every technique it knows: singles, pointing and claiming, naked pairs and triples, hidden pairs, X-Wing, Skyscraper and Y-Wing. After 29 moves it had filled 48 squares and could not go further. That is the position shown in the diagrams.
Here is where the 9 can still go in each row at that moment.
<div style="overflow-x:auto;"><table style="width:100%;border-collapse:collapse;font-size:0.9rem;min-width:480px;"><thead><tr><th style="text-align:left;padding:8px 10px;border-bottom:2px solid var(--ink);">Row</th><th style="text-align:left;padding:8px 10px;border-bottom:2px solid var(--ink);">Squares where 9 can still go</th><th style="text-align:left;padding:8px 10px;border-bottom:2px solid var(--ink);">Inside columns 2, 4 and 9?</th></tr></thead><tbody><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Row 1</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">columns 2, 5, 6</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">No</td></tr><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Row 2</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">columns 1, 6</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">No</td></tr><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Row 3</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">9 already placed</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">n/a</td></tr><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Row 4</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">columns 2, 4, 9</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Yes</td></tr><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Row 5</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">columns 2, 9</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Yes</td></tr><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Row 6</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">columns 1, 2, 4, 5, 7, 9</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">No</td></tr><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Row 7</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">9 already placed</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">n/a</td></tr><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Row 8</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">columns 5, 6, 7</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">No</td></tr><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Row 9</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">columns 4, 9</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Yes</td></tr></tbody></table></div>
Rows 4, 5 and 9 are the only three rows whose 9s fit inside one set of three columns: 2, 4 and 9. Row 4 uses all three columns, while rows 5 and 9 use two each. Using SudokuWiki's way of naming them, that is a 3-2-2 fish. None of the rows has the 9 outside those columns, which is the one condition that matters.
Now look down columns 2, 4 and 9 for 9s that are not in rows 4, 5 or 9. There are four of them.
<div style="overflow-x:auto;"><table style="width:100%;border-collapse:collapse;font-size:0.9rem;min-width:480px;"><thead><tr><th style="text-align:left;padding:8px 10px;border-bottom:2px solid var(--ink);">Square</th><th style="text-align:left;padding:8px 10px;border-bottom:2px solid var(--ink);">Candidates before</th><th style="text-align:left;padding:8px 10px;border-bottom:2px solid var(--ink);">After the Swordfish</th></tr></thead><tbody><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Row 1, column 2</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">6, 9</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">6 (now a single)</td></tr><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Row 6, column 2</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">1, 2, 4, 7, 9</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">1, 2, 4, 7</td></tr><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Row 6, column 4</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">2, 6, 9</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">2, 6</td></tr><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Row 6, column 9</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">2, 8, 9</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">2, 8</td></tr></tbody></table></div>
That is the whole Swordfish: four candidates gone, nothing placed. The cut that matters here is the first one. Row 1, column 2 had only 6 and 9 left, so once the 9 goes, the 6 goes in as a naked single.
From there the board falls apart. After the Swordfish the solver needed nothing but naked singles: 33 of them in a row, starting with row 1, column 2 = 6, then row 3, column 2 = 7 and row 2, column 1 = 9. The finished grid matches the board's only solution.
How often a board needs one
The game on this site never asks for a Swordfish. Its hardest boards are graded up to X-Wing, so a Swordfish is not needed on any board it serves. To get a feel for how often the move matters on harder puzzles, we used the same generator to make 3,000 random boards with about 24 givens and ran the solver on each, with every technique it has turned on.
<div style="overflow-x:auto;"><table style="width:100%;border-collapse:collapse;font-size:0.9rem;min-width:480px;"><thead><tr><th style="text-align:left;padding:8px 10px;border-bottom:2px solid var(--ink);">Swordfish tally, random boards with 24 to 28 givens (most have 24), seeds 1000 to 3999</th><th style="text-align:left;padding:8px 10px;border-bottom:2px solid var(--ink);">Boards</th></tr></thead><tbody><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Stalled even with every move up to Skyscraper and Y-Wing</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">809 of 3,000</td></tr><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Had a Swordfish that cut something at the stall</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">15 of 809</td></tr><tr><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">Went on to be solved once the fish was used</td><td style="padding:8px 10px;border-bottom:1px solid var(--rule, #ddd);vertical-align:top;">4 of 15</td></tr></tbody></table></div>
Read those numbers for what they are. The solver stops at the first position where none of its moves work, and we checked for a Swordfish only at that point, so a fish that might have appeared later in a different solving order is not counted. It still shows the scale: on these boards the move was available at a stuck point on 15 boards out of 3,000, and on only 4 of them was it the one cut that let the rest of the board fall to the solver's usual moves.
In other words, a Swordfish is worth knowing, but it should not be the first thing you hunt for. If you are stuck, check singles, pointing pairs, pairs and X-Wings first. The guide to getting unstuck walks through that order.
How to scan for one
Work one digit at a time. A digit with only a few candidates left on the board is the best place to start, because each row then has few squares to compare.
For that digit, go row by row and write down which columns it can still go in. Ignore rows where it is already placed. Throw out any row with four or more options, since it cannot be part of a three-column fish. You are left with a short list of rows that have two or three options each.
Now try to pick three of those rows whose columns, taken together, come to exactly three. On our board, row 4 lists 2, 4, 9; row 5 lists 2, 9; row 9 lists 4, 9. Together that is 2, 4, 9: three columns. If the union comes to four columns, it is not a Swordfish.
When you find a set, look down each of the three columns for the digit in any other row. Those are the candidates you can cross out. If there are none, the fish is real but useless on this board, and you move on.
Then repeat the same pass with columns as the base. The pattern is symmetrical, and a fish can be visible one way and not the other. Pencil marks need to be complete and current for this to work, so turn on the auto-notes button on the Sudoku page if you want to practise the scan without the bookkeeping.
Mistakes that break it
The most common error is using a row that has the digit somewhere outside the three columns. Take a made-up case: suppose row 5 on our board also had a 9 candidate in column 7. Then row 5 could put its 9 outside columns 2, 4 and 9, the counting argument no longer holds, and none of the four cuts would be safe. Check every candidate in each base row before you cross anything out.
The second is crossing out in the wrong lines. If your base is three rows, the eliminations come from the three columns, not from other squares in the base rows. Swap the words if your base is columns.
The third is going bigger than needed. HoDoKu notes that the same idea with four lines is called a Jellyfish, and that fish larger than that are unnecessary, because a smaller complementary fish will always exist. If you think you have found a five-line fish, look for the smaller one on the other side.
Questions
Is a Swordfish harder than an X-Wing?
The logic is identical, but you compare three lines on each side instead of two, so there is more to keep track of. HoDoKu treats the two as one technique at different sizes. Source: HoDoKu, Basic Fish guide.
Does every row in a Swordfish need the digit three times?
No. Every base line and every cover line needs at least one candidate, yet some crossings can be empty. Our example has three, two and two. Source: HoDoKu, Basic Fish guide.
Does a Swordfish place a digit?
Not by itself. It only removes candidates. In our example one of those cuts left a square with a single option, and that is when a digit went in. Source: this site's solver run on board seed 2904.
What comes after a Swordfish?
Next in size is the Jellyfish, built on four rows and four columns. HoDoKu says fish bigger than that are never needed, since a smaller matching fish will exist. Source: HoDoKu, Basic Fish guide.