I need help with Swordfish

Advanced methods and approaches for solving Sudoku puzzles

I need help with Swordfish

Postby noeldillabough » Mon Jul 11, 2005 5:41 am

I know the premise of swordfish, but I sure don't seem to be able to pick them out while solving puzzles. Here's an example (taken from Simple Sudoku) where a swordfish is next:

Code: Select all
...|479|62.
..4|...|395
926|...|...
---+---+---
.31|...|.69
...|936|...
..9|...|283
---+---+---
.5.|894|716
4.8|...|952
.97|.52|.3.



Can someone please shed some light on this? I'm sure it would help others too who haven't quite mastered the Swordfish.
noeldillabough
 
Posts: 5
Joined: 09 July 2005

Re: I need help with Swordfish

Postby angusj » Mon Jul 11, 2005 6:20 am

noeldillabough wrote:I know the premise of swordfish, but I sure don't seem to be able to pick them out while solving puzzles.

Well, they are often really really hard to find, so don't be discouraged.

Code: Select all
...|...|...
1..|..1|...
...|...|...
-----------
...|...|...
...|...|...
...|...|...
-----------
...|1.1|...
...|...|...
1..|1..|...


If you apply the filter to 1s you'll spot the pattern above. For an explanation have a look at this description of swordfish.

ps: One the topic of hard to spot swordfish, the following puzzle was a killer (ie I gave up and took the hint eventually):

Code: Select all
..4|...|..9
.2.|5..|...
..6|.91|.4.
-----------
...|..2|.6.
64.|.1.|.87
.9.|8..|...
-----------
.3.|64.|7..
...|..7|.5.
1..|...|8..
angusj
 
Posts: 306
Joined: 12 June 2005

Re: I need help with Swordfish

Postby MCC » Mon Jul 11, 2005 9:59 am

angusj wrote:
noeldillabough wrote:I know the premise of swordfish, but I sure don't seem to be able to pick them out while solving puzzles.

ps: One the topic of hard to spot swordfish, the following puzzle was a killer (ie I gave up and took the hint eventually):

Code: Select all
..4|...|..9
.2.|5..|...
..6|.91|.4.
-----------
...|..2|.6.
64.|.1.|.87
.9.|8..|...
-----------
.3.|64.|7..
...|..7|.5.
1..|...|8..


Why look for a swordfish, a couple of 4's can be placed in the grid at;
(r2c6) and (r8c1)?
MCC
 
Posts: 1275
Joined: 08 June 2005

Postby MCC » Mon Jul 11, 2005 10:00 am

Forget the last message , not with it yet.
MCC
 
Posts: 1275
Joined: 08 June 2005

Re: I need help with Swordfish

Postby angusj » Mon Jul 11, 2005 10:03 am

MCC wrote:Forget the last message , not with it yet.

OK:) .
angusj
 
Posts: 306
Joined: 12 June 2005

Re: I need help with Swordfish

Postby MCC » Mon Jul 11, 2005 2:29 pm

angusj wrote:ps: One the topic of hard to spot swordfish, the following puzzle was a killer (ie I gave up and took the hint eventually):

Code: Select all
..4|...|..9
.2.|5..|...
..6|.91|.4.
-----------
...|..2|.6.
64.|.1.|.87
.9.|8..|...
-----------
.3.|64.|7..
...|..7|.5.
1..|...|8..


Have solved it with half a swordfish and guess work.
Now I need to know why?

Working through each number in turn:

There is a swordfish in the 1's but of no use.
There is an x-wing in the 9's but of no use.
The 4's are complete.
Using forced chains in the 2's,6's,7's and 8's leads to no definite placement.
The 5's have two rows of two candidates, not overlapping, nothing obvious.
The 3's seem to be a better approach. There are two columns of two candidates, overlapping in row nine, giving half a swordfish.
I was then able to eliminate some 3's in row nine.

Knowing that there is a swordfish, I needed a connection overlapping the other two columns.
There are two possible columns:
(r1c6)(r5c6) and (r1c7)(r5c7), there are other 3's in these columns but ignore them for the moment.

This is where I take a guess, looking at the two possible columns (r2c6)(r5c6) and (r1c7)(r5c7) and looking at what happens by eliminating the 3's from each column in turn, and by choosing the column that produces the most eliminations after the elimination of the 3's in that column leads to the solution of the puzzle. Lucky guess on my part.

Only by knowing that there was a swordfish led me along this path.
If I'd not known of the swordfish,I would be stuck.

The above is a bit messy but how to complete the other half of the swordfish in the 3's?

Any answers?
MCC
 
Posts: 1275
Joined: 08 June 2005

Postby noeldillabough » Mon Jul 11, 2005 2:45 pm

I figured out what to look for, the "no more than 3 cells" is the thing I missed, I was always looking for 3 cells (like a big xwing). Eventually I'll have this figured:idea:

Code: Select all
...|...|...
...|.3.|3.3
...|...|...
...|.3.|..3
...|...|...
...|...|...
...|...|...
...|.3.|3.3
...|...|...
[/i]
noeldillabough
 
Posts: 5
Joined: 09 July 2005

Re: I need help with Swordfish

Postby angusj » Mon Jul 11, 2005 2:58 pm

MCC wrote:Any answers?


There is a swordfish hidden in the 3s:
Code: Select all
[3578]  [157]   [4]     [237]   [2368]  [36]    [12356] [23]    [9]     
[9]     [2]     [18]    [5]     [368]   [4]     [136]   [7]     [368]   
[3578]  [57]    [6]     [237]   [9]     [1]     [235]   [4]     [2358] 
[578]   [157]   [18]    [4]     [357]   [2]     [9]     [6]     [35]   
[6]     [4]     [235]   [39]    [1]     [359]   [235]   [8]     [7]     
[257]   [9]     [235]   [8]     [3567]  [356]   [4]     [1]     [235]   
[25]    [3]     [25]    [6]     [4]     [8]     [7]     [9]     [1]     
[4]     [8]     [9]     [1]     [23]    [7]     [236]   [5]     [236]   
[1]     [6]     [7]     [239]   [235]   [359]   [8]     [23]    [4]

Note1: You don't need any special solving methods to get to this point.
Note2: The general swordfish definition is 3 rows (or cols) with two or three of a specific candidate in each row and sharing the same 3 cols (or rows). In this case two rows have 3 candidate 3s and one row has only two (see rows 2, 4 & 8). I could definitely explain this better but it's way past my bedtime:) .
angusj
 
Posts: 306
Joined: 12 June 2005

Postby SteveF » Tue Jul 12, 2005 10:58 am

Having used the swordfish I have reached the following:

--4|7--|--9
92-|5-4|-7-
-76|-91|-4-
___________
---|4-2|963
64-|-1-|-87
-9-|8--|41-
___________
-3-|648|791
489|1-7|-5-
167|---|8-4

Can anyone help with the next move?
- I've also tried putting it through angusj's solver (v3.2) which succesfully found the swordfish but comes up with 'no hint possible' at this stage.
SteveF
 
Posts: 86
Joined: 26 March 2005

Postby simes » Tue Jul 12, 2005 11:07 am

Here's part of the log from my solver:
Code: Select all
column 3: unique subset 18 in cells (2,3)(4,3) - removing other candidates for these cells
block 1: column 1 must contain 3, removing 3 from candidates for cell(s) (6,1)
X-Wing found for columns 5 and 7 in rows 2 and 8 for 3 - updating cell(s) (1,5)(6,5)(9,5)(1,7)(3,7)
column 7: disjoint subset 25 in cells (3,7)(5,7) - updating candidates for cell(s) (1,7)(8,7)
block 3: row 3 must contain 5, removing 5 from candidates for cell(s) (3,1)
(1,2) = 5 : Forced from either candidate of (3,1)
(4,2) = 1 : only possible value for this cell
(4,3) = 8 : only possible value for this cell
(2,3) = 1 : only possible value for this cell
(1,7) = 1 : only cell in row 1 that can contain 1
block 3: row 2 must contain 6, removing 6 from candidates for cell(s) (2,5)
X-Wing found for columns 7 and 9 in rows 2 and 8 for 6 - updating cell(s) (1,7)
(1,8) = 2 : Forced from either candidate of (1,1)
(3,7) = 5 : only possible value for this cell
etc
Last edited by simes on Sun Dec 11, 2011 9:37 am, edited 1 time in total.
simes
 
Posts: 324
Joined: 11 March 2005
Location: UK

Postby angusj » Tue Jul 12, 2005 1:31 pm

SteveF wrote:I've also tried putting it through angusj's solver (v3.2) which succesfully found the swordfish but comes up with 'no hint possible' at this stage.

You're a couple of versions behind then:D . The newer versions will step you through solving this with colors.
angusj
 
Posts: 306
Joined: 12 June 2005

Postby MCC » Tue Jul 12, 2005 1:53 pm

Thanks angusj and simes, will need to consider your comments.

I've never used a swordfish before and took this as a challenge.
I believe I understand the principle of swordfish, it's putting in into practice that seems to be the problem.
MCC
 
Posts: 1275
Joined: 08 June 2005

Postby SteveF » Tue Jul 12, 2005 2:04 pm

Yes angusj, in the meantime I had revisited your website and downloaded the latest version which does indeed cope with the position I posted.
I guess I'll need to get upto speed on colours now.

Simes, I can see the step: "(1,2) = 5 : Forced from either candidate of (3,1)". However whereas one value for (3,1) {8} gives a value for (1,2) very quickly the other value {3} takes several (ie more than about 5 steps, at which point I usually start to look elsewhere.
- Am I missing something simpler?
SteveF
 
Posts: 86
Joined: 26 March 2005

Postby simes » Tue Jul 12, 2005 8:22 pm

Apologies SteveF, I was using an older version of my solver that was rather ambitious in it's forcing chain logic. The forcing chain is there, but it's the simpler one "(1,2) = 5 : Forced from either candidate of (8,5)", with another later in the logic.
Last edited by simes on Sun Dec 11, 2011 9:37 am, edited 1 time in total.
simes
 
Posts: 324
Joined: 11 March 2005
Location: UK

Re: I need help with Swordfish

Postby MCC » Fri Jul 15, 2005 10:28 am

angusj wrote:
MCC wrote:Any answers?


There is a swordfish hidden in the 3s:
Code: Select all
[3578]  [157]   [4]     [237]   [2368]  [36]    [12356] [23]    [9]     
[9]     [2]     [18]    [5]     [368]   [4]     [136]   [7]     [368]   
[3578]  [57]    [6]     [237]   [9]     [1]     [235]   [4]     [2358] 
[578]   [157]   [18]    [4]     [357]   [2]     [9]     [6]     [35]   
[6]     [4]     [235]   [39]    [1]     [359]   [235]   [8]     [7]     
[257]   [9]     [235]   [8]     [3567]  [356]   [4]     [1]     [235]   
[25]    [3]     [25]    [6]     [4]     [8]     [7]     [9]     [1]     
[4]     [8]     [9]     [1]     [23]    [7]     [236]   [5]     [236]   
[1]     [6]     [7]     [239]   [235]   [359]   [8]     [23]    [4]

Note1: You don't need any special solving methods to get to this point.
Note2: The general swordfish definition is 3 rows (or cols) with two or three of a specific candidate in each row and sharing the same 3 cols (or rows). In this case two rows have 3 candidate 3s and one row has only two (see rows 2, 4 & 8). I could definitely explain this better but it's way past my bedtime:) .


Thanks angusj, after restarting the puzzle and reaching the above position I was able to find the swordfish.

I was initially looking at the two 3's in column 8 as part of the swordfish, with the elimination of a couple of 3's in the middle of the puzzle (false logic on my part, logic I'm unable to reproduce) led me to believe I'd found the swordfish or a part of it.

Before looking for the swordfish this time I was led astray with simes's x-wing in columns 5 and 7 in rows 2 and 8 for 3's.
Since there are three candidates 3's for rows 2 and 8 I could not see how his program came up with a possible x-wing, so I looked to see if I could eliminate any more 3's but I was unable to see how.
I can only assume that simes's x-wing is formed with hindsight.:?:

Anyway once I'd found the swordfish it was plain sailing from then on.
No forcing necessary.
MCC
 
Posts: 1275
Joined: 08 June 2005


Return to Advanced solving techniques