## Need Suggestions on XWing

Advanced methods and approaches for solving Sudoku puzzles
tso wrote:Here's one that has a Swordfish fairly early on, and an X-wing near the end

Nice puzzle - learned about swordfish from MCC: I had messed up on understanding a swordfish.

So on row 5:
If r5c5=5 then r2c8=5 and r8c9=5
If r5c8=5 then r2c5=5
If r6c9=5 then r8c5=5
So on column 5, 5 must be in r5c5, r2c5 or r8c5
Therefore 5 can be eliminated from r3c5, r5c5 and r9c5.

So I solved the puzzle, but I never saw an X-Wing.

I would have said
Here's one which has a swordfish near the end

My progress was
1) Solved a bunch of easy stuff
2) Got helped to find a "locked candidates" which led to the swordfish
3) Got helped to see and understand the swordfish
4) Solved a bunch of easy stuff

No "Swordfish fairly early on, and an X-wing near the end".

Anyway, thanks everybody for the help.

Mac
QBasicMac

Posts: 441
Joined: 13 July 2005

SteveF wrote:However on looking closer, I think there is a second swordfish in the 5's in columns 4, 6 and 7.

The cells involved are:

r3c4 r4c4
r3c6 r4c6 r9c6
r4c7 r9c7

It allows the placement of the same 5 as MCC gives.

Is this swordfish also valid?

It looks right to me!
Nick67

Posts: 113
Joined: 24 August 2007

How great! Two (pick one) swordfish appear at the same time. One in each dimension. Thanks for the observation, SteveF.

But in trying to analyze yours, I came to the conclusion that my analysis of the other swordfish was flawed. I feel I have a bad argument that led to magical correct eraseure of some 5's that led to the solution. I get the gut feeling it is the equivalent of a guess that worked.

Could someone please examine my "If this then that" argument and correct it or confirm that it is indeed correct (which I doubt).

And, if you have the time, analyze SteveF's. I couldn't see that it led to any pencilmark erasures. Probably due to faulty analysis not working in this case.

Thanks,

Mac
QBasicMac

Posts: 441
Joined: 13 July 2005

I can see what you're saying Mac. You've considered all possible outcomes for placing a 5 in row 5 => the elimination of 5s in column 5. I think this is probably what is called an inelegant approach - but it's logical. The swordfish was quicker, as long as you find it, and eliminates 5 candidate 5s.

SteveFs swordfish was floating by sideways ie down the columns rather than across the rows - that way you could eliminate 5s in r3 c 5 & 9 and row 9 c 5 & 9.
emm

Posts: 987
Joined: 02 July 2005

SteveF wrote:...
Is this swordfish also valid?

Yes -- there are two mutually exclusive simultaneous Swordfish -- one in columns, one in rows:

Code: Select all
`  .  .  .  |  .  .  .  |  .  .  .   .  .  .  |  . (5) .  |  . (5) .    .  .  .  | [5] 5 [5] |  .  5  5  ----------+-----------+----------  .  .  .  | [5] . [5] | [5] .  .   .  .  .  |  . (5) .  |  . (5)(5)  .  .  .  |  .  .  .  |  .  .  .  ----------+-----------+----------  .  .  .  |  .  .  .  |  .  .  .   .  .  .  |  . (5) .  |  .  . (5)  .  .  .  |  .  5 [5] | [5] .  5 `

The first Swordfish -- marked in the diagram with (parenthesis) -- is three ROWS (2, 5 and 8), in which all candidate 5s lie in the same three COLUMNS (5, 8 and 9), eliminating this candidate from all other ROWS within those COLUMNS.

The second Swordfish -- marked in the diagram with [brackets] -- is three COLUMNS (4, 6 and 7), in which all candidate 5s lie in the same three ROWS (4, 5 and 9), eliminating this candidate from all other COLUMNS within those ROWS.

The first makes more immediate eliminations, but either is enough to move on.
tso

Posts: 798
Joined: 22 June 2005

QBasicMac wrote:
tso wrote:Here's one that has a Swordfish fairly early on, and an X-wing near the end

Nice puzzle - learned about swordfish from MCC: I had messed up on understanding a swordfish.

So on row 5:
If r5c5=5 then r2c8=5 and r8c9=5
If r5c8=5 then r2c5=5
If r6c9=5 then r8c5=5
So on column 5, 5 must be in r5c5, r2c5 or r8c5
Therefore 5 can be eliminated from r3c5, r5c5 and r9c5.

So I solved the puzzle, but I never saw an X-Wing.

There is no justification to eliminate r5c5 (my bold above). That's why you didn't need an x-wing later. It COULD have been a 5, in which you wouldn't have solved the puzzle at all. R5c5 is one of the cells making up the Swordfish.
tso

Posts: 798
Joined: 22 June 2005

tso wrote:[There is no justification to eliminate r5c5 (my bold above).

I had a hunch something was amiss. As I said - the equivalent of guessing.

Well, I have to study this for a while. See you in a week.

Mac
QBasicMac

Posts: 441
Joined: 13 July 2005

Mac

Once you have located either of the two swordfishes and eliminated candidates (you do not eliminate candidates from the swordfish at this stage), you'll see that one corner of the swordfish I'd mentioned is the only candidate left standing in box 3, and can be placed.

This placement enables you to eliminate two other candidates in my swordfish, leaving you with an x-wing plus the other swordfish.
MCC

Posts: 1275
Joined: 08 June 2005

em wrote:SteveFs swordfish was floating by sideways ie down the columns rather than across the rows - that way you could eliminate 5s in r3 c 5 & 9 and row 9 c 5 & 9.

OK, trying to get it here. My lengthy description is simply another way of describing a swordfish, but I was not correct.

So let me start afresh and look at the other one:

The swordfish is
r3c4 and r4c4
r3c6, r4c6 and r9c6
r4c7 and r9c7

If r3c4=5 then
5 can be removed from r3c5, r3c6, r3c8 and r3c9
and since the only 5's column 6 will be r4c6 and r9c6:
If r4c6=5 then r4c7<>5, but there are only two 5's in column 7 therefore r9c7=5
5 can be removed from r9c5, r9c6 and r9c9
If r9c6=5
5 can be removed from r9c5, r9c7 and r9c9
Thus in either case 5 can be removed from r9c5 and r9c9

If r3c4<>5 then we set the only other 5 in column 4: r4c4=5
Therefore r4c6<>5 and r4c7<>5
and we set the only other 5 in column 7: r9c7=5
5 can be removed from r9c5, r9c6 and r9c9
Furthermore, since r9c6<>5 and r4c6<>5, then this leaves r3c6=5
5 can be removed from r3c4, r3c5, r3c8 and r3c9.

Summary
If r3c4=5 then
5 can be removed from r3c5, r3c6, r3c8 and r3c9
5 can be removed from r9c5 and r9c9
If r3c4<>5 then
5 can be removed from r3c4, r3c5, r3c8 and r3c9
5 can be removed from r9c5, r9c6 and r9c9

Combining the cases, we see that
5 can be removed from r3c5, r3c8 and r3c9
5 can be removed from r9c5 and r9c9

But you say, I can eliminate 5s in r3 c5 & c9 and row 9 c5 & c9.

I got an additional one: r3c8.

Something still wrong with my logic?

Mac
QBasicMac

Posts: 441
Joined: 13 July 2005

Sorry that this is slightly off the topic under discussion, but I just wanted to check that I understand the subtleties of these techniques - could you say that the Xwing and Swordfish methods are subsets of the more general Colouring method? ie Am I right that if you look for colouring possibilities, you will find any Xwing or Swordfish that are present in the puzzle?

Cheers,

Chris
ChrisT

Posts: 36
Joined: 16 October 2005

ChrisT wrote:could you say that the Xwing and Swordfish methods are subsets of the more general Colouring method?

You could, but you'd be wrong .

ChrisT wrote:Am I right that if you look for colouring possibilities, you will find any Xwing or Swordfish that are present in the puzzle?

X-wing will be detected with multicoloring techniques but Swordfish won't.
angusj

Posts: 306
Joined: 12 June 2005

angusj wrote:You could, but you'd be wrong .

Well, that's very generous and liberal of you. Thanks!

Can you explain why? Am I correct for x-wing but wrong for swordfish?

Chris
ChrisT

Posts: 36
Joined: 16 October 2005

QBasicMac wrote:Something still wrong with my logic?

Looking at it again I'm tempted to suggest that tso was incorrect - both swordfish eliminate the candidates r3c5, r3c8, r3c9, r9c5, r9c9 - the same as your brute force method. (steadfastly ignoring interrupted topic)
emm

Posts: 987
Joined: 02 July 2005

ChrisT wrote:Can you explain why? Am I correct for x-wing but wrong for swordfish?

It's hard to explain properly without writing tomes.
Anyhow, the following 2 references are hopefully a start:
http://angusj.com/sudoku/hints.php#swordfish
http://angusj.com/sudoku/hints.php#colors
angusj

Posts: 306
Joined: 12 June 2005

OK, looking the example on your web page, I can see what you mean. Because the swordfish pattern contains 3 candidates in one or more rows/columns you could not solve it by a direct colouring method. If you really wanted, I still reckon that you could do it by a 2-stage colouring process, but that would be unnecessarily complicated I guess, considering it would be much easier just to recognise the swordfish pattern.

Cheers for clearing that up for me.

Chris
ChrisT

Posts: 36
Joined: 16 October 2005

Previous