Swordfish: Generalized and Simplified

Advanced methods and approaches for solving Sudoku puzzles

Swordfish: Generalized and Simplified

Postby nedBlake » Sat Oct 22, 2016 2:50 pm

I have always found the descriptions of the logic behind the Swordfish strategy a little confusing. Often they start out with showing how the 3-3-3 Swordfish would result in an X-Wing, no matter which of the possible solutions in the swordfish was the solution, but it wasn't clear how that applied to other Swordfish configurations. The following takes a different approach that follows directly from the rules of Sudoku that I feel is clearer, and in fact is also a simple proof of the X-Wing strategy rather than being a derivative of it.

The following N x N row-column grid samples are a generalization of the Swordfish. Although we could have chosen columns, we will assume here that in each grid the rows contain all the possible solutions for that row, and that the columns may contain other possibles not in the grid shown that are our targets that we can eliminate. (You have to use your imagination here a bit to keep these samples easy to view.) Furthermore there can be, and most likely are, other rows and columns between the rows and columns shown.
Code: Select all
                           Three N x N Row-Column Grids

              2       2              3       3       3              4       4       4       4                 
              2       2              3       3                      4               4 

                                     3       3                      4       4

                                                                    4                       4

The other conditions to be met are that there is at least one possible (more about this below) in each of the N rows, and that each of the N columns contains at least one of these row possibles.

The proof of the strategy follows directly from the rules. We know one of the row possibles must be the solution, since the row must have one solution of that possible. And so there must be N solutions in each N x N grid.

We also know from the rules that in each column there can be only one solution of that possible. So since there are N solutions and N columns, and no two solutions can appear in the same column, there must be one in each column. And so any other instance of that possible in that column that is not in the grid (since we don't know which possibles in the grid are the solutions) can be eliminated.

This is a little different from the conditions often stated for the Swordfish, which in the above samples, would say that there must be at least 2 possibles in each grid row. It is true that if there is only one, it is a single and therefore is the solution. But if you choose to ignore this fact, the above logic still works. Imagine the X-Wing is missing one possible. The above logic tells you that the 2 solutions must be in opposite corners. That means in this 3-leg X-Wing there can only be one diagonal on which the solutions lie. And so in this case you know which possibles are the solution, which gives you the same result as taking advantage of the single.

It appears that N can be any reasonable number, although it would have to be 2 or greater and not more than 8 (or you wouldn't have a row or column where elimination could take place). I don't know - probably the larger N is the less useful this strategy is.
2018 Supporter
Posts: 36
Joined: 08 May 2016
Location: New Bern, North Caroline

Return to Advanced solving techniques