Sudoku Programmers Forum Index

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log inLog in          Games  Calendar

Log in to check your private messagesLog in to check your private messages   

Puzzle 5 (from Swordfish compendium)

 
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Puzzles
View previous topic :: View next topic  
Author Message
Animator

Joined: 26 Apr 2005
Posts: 18
:

Items
PostPosted: Wed Apr 27, 2005 8:46 pm    Post subject: Puzzle 5 (from Swordfish compendium) Reply with quote

I've got a problem solving it...

Where I got:


Code:

* 4 * | 6 * * | * * 9
8 * * | 7 * 4 | 6 5 *
6 * 1 | 9 * 8 | 2 4 *
---------------------
1 * 6 | * 9 * | 4 * 8
2 * * | * 4 * | 5 * 6
5 * 4 | * 6 * | * * *
---------------------
4 * 8 | 2 * 9 | 7 6 *
* 6 * | * * 1 | * * 4
9 * * | 4 * 6 | * 3 *


With pencilmarks (numbers followed by ? are possibilities):

Code:


3/7? 4          2/3/5/7? | 6        1/2? 3/5?           | 1/3/8?   1/7/8?     9
8    2/3/9?     2/3/9?   | 7        1/2? 4              | 6        5          1/3?
6    3/5/7?     1        | 9        3/5? 8              | 2        4          3/7?
--------------------------------------------------------------------------------------
1    3/7?       6        | 3/5?     9    2/3/5/7?       | 4        2/7?       8
2    3/7/8/9?   3/7/9?   | 1/8?     4    3/7?           | 5        1/7/9?     6
5    7/8/9?     4        | 1/8?     6    2/7?           | 1/3/9?   1/2/7/9?   1/2/3/7?
--------------------------------------------------------------------------------------
4    1/3/5?     8        | 2        3/5? 9              | 7        6          1/5?
3/7? 6          2/3/5/7? | 3/5?     7/8? 1              | 8/9?     2/8/9?     4
9    1/2/5/7?   2/7?     | 4        7/8? 6              | 1/8?     3          1/2/5?



When I use rubylips's solver then it outputs this:

Code:

1. The value 2 in Box [1,2] must lie in Column 5.
The value 3 in Row 6 must lie in Box [2,3].
The value 8 in Box [3,2] must lie in Column 5.
The values 1 and 8 occupy the cells (5,4) and (6,4) in some order.
The values 1 and 2 occupy the cells (1,5) and (2,5) in some order.
The values 7 and 8 occupy the cells (8,5) and (9,5) in some order.
3s must appear in the cells (1,1) and (8,4) or the cells (1,6) and (8,1). [3-leg Swordfish]
The cell (6,7) is the only candidate for the value 3 in Column 7.


The first 5 are already in my pencil marks, it is the swordfish that is bottering me...

When I list all the possible cells for 3 then I get this grid:
Code:

3? 4  3? | 6  *  3? | 3? *  9 
8  3? 3? | 7  *  4  | 6  5  3?
6  3? 1  | 9  3? 8  | 2  4  3?
------------------------------
1  3? 6  | 3? 9  3? | 4  *  8
2  3? 3? | *  4  3? | 5  *  6
5  *  4  | *  6  *  | 3? *  3?
------------------------------
4  3? 8  | 2  3? 9  | 7  6  *
3? 6  3? | 3? *  1  | *  *  4
9  *  *  | 4  *  6  | *  3  *


If (5, 6) couldn't be 3 then I see the swordfish, but if it can have 3, then I fail to see it...

Am I missing something?

(Note, there also is a swordfish of 5's (or atleast I believe so), which allowed me to remove the 5 from (9, 3))


Any help?
Back to top
View user's profile Send private message
rubylips

Joined: 07 Apr 2005
Posts: 62
:
Location: London

Items
PostPosted: Wed Apr 27, 2005 11:19 pm    Post subject: Reply with quote

Thanks for the posting.

The first wing occurs in Column 1, where the two candidates for the value 3 are the cells r1c1 and r8c1.

The second (3-leg) wing occurs across Box 7 (or [3,2]), Column 5 and Box 2 (or [1,2]). There are two candidates for the value 3 in each sector, which means that exactly one of the cells r8c4 and r1c6 must contain a 3.

When we put these two facts together, we see that 3s must appear in the cells r1c1 and r8c4 or the cells r1c6 and r8c1, which enables us to remove 3 as a candidate for the cells r1c3, r1c7 and r8c3. In particular, now that r1c7 is no longer a candidate, the cell r6c7 is left as the sole candidate for the value 3 in Column 7.

I'll think about the swordfish in the 5s ...
Back to top
View user's profile Send private message Visit poster's website
Animator

Joined: 26 Apr 2005
Posts: 18
:

Items
PostPosted: Thu Apr 28, 2005 7:38 am    Post subject: Reply with quote

Hmm, I find this to be a different swordfish then the one I've seen (although I can't say I've seen that many)

The 5-swordfish for example allows you to write down (as in only 6 cells):

Code:

  (1,3),        (1,6)
         (4,4), (4,6)
  (8,3), (8,4)


If I try to do the same with the 3's then I failt to write down the column 6, because it has 3 possibilities...

Code:

  (1,1),        (1,6)
         (4,4), (4,6)
                (5,6)?
  (8,1), (8,4)


Now when you try it then it is obvious that 3 can only occur on (1, 1) and (1, 6)...
Back to top
View user's profile Send private message
Tempbow

Joined: 18 Apr 2005
Posts: 22
:

Items
PostPosted: Sat Apr 30, 2005 1:39 am    Post subject: Reply with quote

rubylips wrote:


The first wing occurs in Column 1, where the two candidates for the value 3 are the cells r1c1 and r8c1.

The second (3-leg) wing occurs across **Box 7** (or [3,2]), Column 5 and Box 2 (or [1,2]). There are two candidates for the value 3 in each sector, which means that exactly one of the cells r8c4 and r1c6 must contain a 3.

When we put these two facts together, we see that 3s must appear in the cells r1c1 and r8c4 or the cells r1c6 and r8c1, which enables us to remove 3 as a candidate for the cells r1c3, r1c7 and r8c3. In particular, now that r1c7 is no longer a candidate, the cell r6c7 is left as the sole candidate for the value 3 in Column 7.

In the above quote, I think you put Box 7 incorrectly for box 8.

Previously I saw an excellent definition of the Swordfish along the lines:
Look for N *columns* (2 for X-wing, 3 for the Swordfish, 4 for a Jellyfish, 5 for a Squirmbag) with only two candidate cells for ONE given digit. If these fall on exactly N common *rows*, and each of those rows has at least 2 candidate cells, then all N rows can be cleared of that digit (except in the defining cells!). (Ditto for *rows* and *columns*)

That definition does not seem to fit this case:

Code:
 +---+---+---+
 | 4 |6  |  9|
 |8  |7 4|65 |
 |6 1|9 8|24 |
 +---+---+---+
 |1 6| 9 |4 8|
 |2  | 4 |5 6|
 |5 4| 6 |   |
 +---+---+---+
 |4 8|2 9|76 |
 | 6 |  1|  4|
 |9  |4 6| 3 |
 +---+---+---+

Where the state table for possible 3 is:

Code:
 +---+---+---+
 |3.3|..3|3..|
 |.33|...|..3|
 |.3.|.3.|..3|
 +---+---+---+
 |.3.|3.3|...|
 |.33|..3|...|
 |...|...|3.3|
 +---+---+---+
 |.3.|.3.|...|
 |3.3|3..|...|
 |...|...|.*.|
 +---+---+---+


and the composite state table is:

Code:
37        4         2357      6         12        35        138       178       9
8         239       239       7         12        4         6         5         13
6         357       1         9         35        8         2         4         37
1         37        6         35        9         2357      4         27        8
2         3789      379       18        4         37        5         179       6
5         789       4         18        6         27        139       1279      1237
4         135       8         2         35        9         7         6         15
37        6         2357      35        78        1         89        289       4
9         1257      27        4         78        6         18        3         125


Can you suggest a modified definition of Swordfish (et al) that encompasses the more generalised example?
Back to top
View user's profile Send private message
IJ

Joined: 15 Apr 2005
Posts: 16
:

Items
PostPosted: Sat Apr 30, 2005 1:43 pm    Post subject: Reply with quote

Personally, I wouldn't call this Swordfish, as it is another order of complexity, and therefore should perhaps have another name? Up to Rubylips, of course.

However, I would describe this example by saying:

3 units have two candidate cells (in this case Col 1, Boxes 2 and 7)

3 other units (in this case Rows 1 & 9, and col 5) also have 2 of the 6 candidate cells.

The second set of units can be cleared, except for the intersections with the first 3 (i.e. the first 6 defining cells)

This definition also works for the standard Swordfish model, where all the first units are rows (or columns) and the second set are columns (or rows).

You can "N it up" to:

Look for N units that have only 2 candidate cells for a given digit, and a second descreet set of N intersecting units that also contain 2 of the candidate cells. The second set of N units can be cleared of the digit in question.

Rubylips - do you have a better, or more succinct description?
Back to top
View user's profile Send private message
rubylips

Joined: 07 Apr 2005
Posts: 62
:
Location: London

Items
PostPosted: Tue May 03, 2005 6:34 pm    Post subject: Reply with quote

Here's an attempt at a more precise definition of a Swordfish:

A sector is the generic term for a row, column or box.

A unit-length string comprises two cells within a single sector that are the only possible candidate positions for some given value within that sector.

Two strings are connected if they share a common-cell and have been defined using the same value. Of course, connected strings will have to occur across different sector types - e.g., one string in a column could connect to another in a box.

An n-leg string comprises n connected unit-length stings.

Some logical observations:

Provided that a string has an odd number of legs, exactly one of its end cells must contain the given value.

When we find two strings, each with an odd number of legs, such that their end points lie on the same row (or column), we know that exactly one of the two end-points on each row (or column) must contain the given value. This allows us to eliminate the given value as a candidate for the remaining cells in each row (or column).

More definitions:

When the two strings are of unit length, the pattern is called an X-Wings.

When one or more of the strings has length greater than one, the pattern is known as a Swordfish.
Back to top
View user's profile Send private message Visit poster's website
Tempbow

Joined: 18 Apr 2005
Posts: 22
:

Items
PostPosted: Tue May 03, 2005 10:05 pm    Post subject: Reply with quote

IJ wrote:
<snip>

3 units have two candidate cells (in this case Col 1, Boxes 2 and 7)

3 other units (in this case Rows 1 & 9, and col 5) also have 2 of the 6 candidate cells.

<snip>


Could you do me a favour, and edit this posting? I can't follow your logic, and I *think* you may have got some numbers wrong in there.

Confused ... Terry
Back to top
View user's profile Send private message
Tempbow

Joined: 18 Apr 2005
Posts: 22
:

Items
PostPosted: Tue May 03, 2005 11:27 pm    Post subject: Reply with quote

Thanks, that is a good definition!
Back to top
View user's profile Send private message
AMcK

Joined: 07 Apr 2005
Posts: 89
:
Location: Cambridge

Items
PostPosted: Fri May 20, 2005 9:58 am    Post subject: Colouring solution Reply with quote

Starting from

* 4 * | 6 * * | * * 9
8 * * | 7 * 4 | 6 5 *
6 * 1 | 9 * 8 | 2 4 *
---------------------
1 * 6 | * 9 * | 4 * 8
2 * * | * 4 * | 5 * 6
5 * 4 | * 6 * | * * *
---------------------
4 * 8 | 2 * 9 | 7 6 *
* 6 * | * * 1 | * * 4
9 * * | 4 * 6 | * 3 *


The 3-rules take us to

Code:

37   4   2357   6   12   35   138   178   9
8   239   239   7   12   4   6   5   13
6   357   1   9   35   8   2   4   37
1   37   6   35   9   2357   4   27   8
2   3789   379   18   4   37   5   179   6
5   789   4   18   6   27   139   1279   1237
4   135   8   2   35   9   7   6   15
37   6   2357   35   78   1   89   289   4
9   1257   257   4   78   6   18   3   125


Colouring digit 3 then yields:

Conjugate row 6: digit 3 cells {6,7} {6,9}
Colour: {6,7} (a) {6,9} (b)
Conjugate row 7: digit 3 cells {7,2} {7,5}
Colour: {7,2} (c) {7,5} (d)
Conjugate column 1: digit 3 cells {1,1} {8,1}
Colour: {1,1} (e) {8,1} (f)
Conjugate column 4: digit 3 cells {4,4} {8,4}
Colour: {4,4} (g) {8,4} (h)
Conjugate column 5: digit 3 cells {3,5} {7,5}
Colour: {3,5} (c) {7,5} (d)
Conjugate column 7: digit 3 cells {1,7} {6,7}
Colour: {1,7} (b) {6,7} (a)
Conjugate box 2: digit 3 cells {1,6} {3,5}
Colour: {1,6} (d) {3,5} (c)
Conjugate box 6: digit 3 cells {6,7} {6,9}
Colour: {6,7} (a) {6,9} (b)
Conjugate box 8: digit 3 cells {7,5} {8,4}
Recolour: {4,4} (g->d)
Recolour: {8,4} (h->c)
Colour: {7,5} (d) {8,4} (c)
Exclusion in row 1: colours e d
Exclusion in row 1: colours e b
Exclusion in row 1: colours d b
Exclusion in row 8: colours f c
Exclusion in box 7: colours c f
Colour exclusion: c/d excludes f/e
Recolour: {1,1} (e->c)
Recolour: {8,1} (f->d)

With the colour map

Code:

c   -   *   -   -   d   b   -   -
-   *   *   -   -   -   -   -   *
-   *   -   -   c   -   -   -   *
-   *   -   d   -   *   -   -   -
-   *   *   -   -   *   -   -   -
-   -   -   -   -   -   a   -   b
-   c   -   -   d   -   -   -   -
d   -   *   c   -   -   -   -   -
-   -   -   -   -   -   -   *   -


So that 3 reductions are possible using the c/d pairs:

Row 1 reduction: digit 3 colours c/d cell {1,3} before 2357 after 257
Row 1 reduction: digit 3 colours c/d cell {1,7} before 138 after 18
Row 8 reduction: digit 3 colours d/c cell {8,3} before 2357 after 257

Colouring digit 5 is also possible

Conjugate row 1: digit 5 cells {1,3} {1,6}
Colour: {1,3} (a) {1,6} (b)
Conjugate row 3: digit 5 cells {3,2} {3,5}
Colour: {3,2} (c) {3,5} (d)
Conjugate row 4: digit 5 cells {4,4} {4,6}
Colour: {4,4} (e) {4,6} (f)
Conjugate row 8: digit 5 cells {8,3} {8,4}
Colour: {8,3} (g) {8,4} (h)
Conjugate column 4: digit 5 cells {4,4} {8,4}
Recolour: {8,3} (g->e)
Recolour: {8,4} (h->f)
Colour: {4,4} (e) {8,4} (f)
Conjugate column 5: digit 5 cells {3,5} {7,5}
Colour: {3,5} (d) {7,5} (c)
Conjugate column 6: digit 5 cells {1,6} {4,6}
Recolour: {4,4} (e->b)
Recolour: {4,6} (f->a)
Recolour: {8,3} (e->b)
Recolour: {8,4} (f->a)
Colour: {1,6} (b) {4,6} (a)
Conjugate column 9: digit 5 cells {7,9} {9,9}
Colour: {7,9} (i) {9,9} (j)
Conjugate box 1: digit 5 cells {1,3} {3,2}
Recolour: {3,2} (c->b)
Recolour: {3,5} (d->a)
Recolour: {7,5} (c->b)
Colour: {1,3} (a) {3,2} (b)
Conjugate box 2: digit 5 cells {1,6} {3,5}
Colour: {1,6} (b) {3,5} (a)
Conjugate box 5: digit 5 cells {4,4} {4,6}
Colour: {4,4} (b) {4,6} (a)
Conjugate box 8: digit 5 cells {7,5} {8,4}
Colour: {7,5} (b) {8,4} (a)
Conjugate box 9: digit 5 cells {7,9} {9,9}
Colour: {7,9} (i) {9,9} (j)
Exclusion in row 7: colours b i

Color map for digit 5 is

Code:

-   -   a   -   -   b   -   -   -
-   -   -   -   -   -   -   *   -
-   b   -   -   a   -   -   -   -
-   -   -   b   -   a   -   -   -
-   -   -   -   -   -   *   -   -
*   -   -   -   -   -   -   -   -
-   *   -   -   b   -   -   -   i
-   -   b   a   -   -   -   -   -
-   *   *   -   -   -   -   -   j


So that one more reduction is possible using the a/b pair

Column 3 reduction: digit 5 colours a/b cell {9,3} before 257 after 27

The resulting grid after the 4 reductions is

Code:

37   4   257   6   12   35   18   178   9
8   239   239   7   12   4   6   5   13
6   357   1   9   35   8   2   4   37
1   37   6   35   9   2357   4   27   8
2   3789   379   18   4   37   5   179   6
5   789   4   18   6   27   139   1279   1237
4   135   8   2   35   9   7   6   15
37   6   257   35   78   1   89   289   4
9   1257   27   4   78   6   18   3   125


Applying the 3-rules (although it needs N=3) solves as

Code:

7   4   5   6   2   3   8   1   9
8   2   9   7   1   4   6   5   3
6   3   1   9   5   8   2   4   7
1   7   6   3   9   5   4   2   8
2   8   3   1   4   7   5   9   6
5   9   4   8   6   2   3   7   1
4   1   8   2   3   9   7   6   5
3   6   2   5   7   1   9   8   4
9   5   7   4   8   6   1   3   2


Please post more difficult Jellyfish and Squirmbags Smile

Regards
Andrew
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Puzzles All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Sudoku Programmers topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group

Igloo Theme Version 1.0 :: Created By: Andrew Charron