## About the arithmetic of Ultimate Fish

Advanced methods and approaches for solving Sudoku puzzles

### About the arithmetic of Ultimate Fish

Maybe you've read in the Programmer's forum about my rules regarding Ultimate Fish. Experimenting with these patterns for a while now, I've come to the conclusion that it can all be put even simpler in just two rules.

Construction rule: We have a Fish pattern if we can construct two sets of sectors, a base set and a cover set, in such a way that every candidate of a given digit belongs to at least as many cover sectors as it belongs to base sectors.

A sector can be any row, column or box. Please note that this rule doesn't require there to be an equal number of base and cover sectors. This way you can handle Finned Fish pretty much the same way you handle Finless Fish. You just cover the fin cells with additonal cover sectors. However the requirement for an exclusion candidate is getting higher in this case.
Now, to decide which candidates can be excluded, we need to know how many excess cover sectors we have. I'll call this the number of fin sectors.

Number of fin sectors = Number of cover sectors - Number of base sectors

With this convention the second rule simply is:

Exclusion rule: Any candidate of the digit in question, whose individual excess number of cover sectors is greater than the number of fin sectors in the pattern, can be eliminated.

With individual excess number of cover sectors I mean the difference between the number of cover sectors and the number of base sectors this candidate belongs to.
Why is this? Every candidate considered to be true removes all sectors it belongs to from both sets. The construction rule makes sure that every candidate removes at least as many cover sectors as it removes base sectors. So if you ever reach a state where there are less cover sectors than base sectors left, the puzzle isn't solvable anymore, because in the end you're either left with a base sector with an empty cell or you have to put more than one instance of the digit into the same cover sector. This leads directly to the exclusion rule, because any candidate whose individual excess number of cover sectors is greater than the excess number of cover sectors in the pattern would leave less cover sectors than base sectors if it was true.

Now, to give an example I'll show how to calculate the hidden pattern from a list of base and cover sectors.
In this case I'll take a pattern from the latest discussion on the Ultimate FISH Guide: r348c8b1/r12c567b9.
This pattern has 5 base and 6 cover sectors and therefore 1 fin sector.

Now the number of base sectors / cover sectors for each possible candidate are:
Code: Select all
1/1 1/1 1/1 | 0/1 0/2 0/2 | 0/2 1/1 0/1
1/1 1/1 1/1 | 0/1 0/2 0/2 | 0/2 1/1 0/1
2/0 2/0 2/0 | 1/0 1/1 1/1 | 1/1 2/0 1/0
-------------+-------------+-------------
1/0 1/0 1/0 | 1/0 1/1 1/1 | 1/1 2/0 1/0
0/0 0/0 0/0 | 0/0 0/1 0/1 | 0/1 1/0 0/0
0/0 0/0 0/0 | 0/0 0/1 0/1 | 0/1 1/0 0/0
-------------+-------------+-------------
0/0 0/0 0/0 | 0/0 0/1 0/1 | 0/2 1/1 0/1
1/0 1/0 1/0 | 1/0 1/1 1/1 | 1/2 2/1 1/1
0/0 0/0 0/0 | 0/0 0/1 0/1 | 0/2 1/1 0/1

Since we're only interested in the excess number of cover sectors we can subtract the base numbers from the cover numbers:
Code: Select all
0  0  0 | +1 +2 +2 | +2  0 +1
0  0  0 | +1 +2 +2 | +2  0 +1
-2 -2 -2 | -1  0  0 |  0 -2 -1
----------+----------+----------
-1 -1 -1 | -1  0  0 |  0 -2 -1
0  0  0 |  0 +1 +1 | +1 -1  0
0  0  0 |  0 +1 +1 | +1 -1  0
----------+----------+----------
0  0  0 |  0 +1 +1 | +2  0 +1
-1 -1 -1 | -1  0  0 | +1 -1  0
0  0  0 |  0 +1 +1 | +2  0 +1

Now every cell with a negative number must be empty, because a candidate there would violate the construction rule. And since we have 1 fin sector in this case every candidate with an excess number of at least +2 can be eliminated. This leads to the following hidden pattern:
Code: Select all
. . . | . * * | * . .
. . . | . * * | * . .
/ / / | / . . | . / /
-------+-------+-------
/ / / | / . . | . / /
. . . | . . . | . / .
. . . | . . . | . / .
-------+-------+-------
. . . | . . . | * . .
/ / / | / . . | . / .
. . . | . . . | * . .

/ = empty cell
. = cell may or may not contain a candidate
* = possible exclusions

Now I want to show how you can construct bigger Fish patterns of smaller Almost Fish.
In the Ultimate FISH Guide the following (Kraken) Jellyfish was supposed for the above pattern:
Code: Select all
Only the 2s:
2  .  . |  .  . -2 |  . *2  2
2  .  . |  2 -2  . |  .  .  2
.  .  . |  . *2 *2 | *2  .  .
---------+----------+----------
.  .  . |  .  . *2 | #2  .  .
.  .  2 |  2  .  . |  2  .  .
.  .  2 |  2  .  . |  .  .  2
---------+----------+----------
.  .  . |  2  .  . | -2 *2  .
.  .  . |  . *2 *2 | *2  . *2
.  .  . |  .  .  . |  .  .  .

jellyfish r348c8\c56b39 plus remote fin r4c7, implies r1c6<>2, r2c5<>2 and r7c7<>2

Now, regarding the exclusions r1c6 and r2c5 I'd like to call the candidate r4c7 an obstacle (for the lack of a better name), because it prevents the Jellyfish and doesn't directly see these exclusion candidates.
However it does see them via the grouped strong link in row 3. This grouped strong link can be viewed as a Cyclopsfish r3\b2 with obstacle r3c7 and potential eliminations r1c6 and r2c45.
These two Almost Fish patterns can be combined into one by simply adding up both base sets and both cover sets. Thereby the individual excess cover numbers also add up. Since the exclusion candidates common to both patterns (r1c6 and r2c5) have an excess cover number of +1 for each individual pattern, these add up to +2 in the combined pattern giving room for one additional cover sector covering the obstacles r3c7 and r4c7: column 7. This yields the combined pattern r3348c8\c567b239.
Please note that my rules don't forbid the same sectors to be added multiple times to the same set. However such a pattern is very abstract and you probably would rather transform it. So as I explained in the Ultimate FISH Guide you can add the same sectors to both the base and the cover set without hurting the pattern. This should also be obvious from the arithmetic I've shown above, because the individual excess cover numbers aren't changed thereby.
So let's add r12 to both sides yielding r123348c8\r12c567b239. Now we can replace r123 by b123, because both sets contain exactly the same candidates, again not changing the individual excess cover numbers. This yields r348c8b123\r12c567b239. Now we can remove b23 from both sides and get r348c8b1\r12c567b9. This is a Mutant Squirmbag with one fin sector that explains all exclusions without a remote fin.

So, I hope I didn't scare you all away. I think with a little practise these arithmetics can make it a lot easier to catch some of the bigger fish or to transform one fish into another. I'm not very creative in inventing names, so if anybody has an idea for a more illustrative name for some of the above, be my guest.

Obi-Wahn

Posts: 63
Joined: 05 January 2007

### single-finned examples

Code: Select all
. / . | . . . | . . .
. . . | * . * | . . .
. / . | . . . | . . .
-------+-------+------
. / . | . / . | . . .
. . . | . . . | . . .
. / . | . / . | . . .
-------+-------+------
. / . | . / . | . . .
. / . | . / . | . . .
. / . | . / . | . . .

• finned X-wing: c25\r25, with a fin in cells r13c5
• finned Franken X-wing: c25\r5b2, with fin = r2c2
• eel 2\3: c25\r25b2
Code: Select all
. . . | . . . | . . .
. / . | / . / | / / /
. . . | . . . | . . .
-------+-------+------
. / . | . . . | . . .
. . . | . * . | . . .
. / . | . . . | . . .
-------+-------+------
. / . | . . . | . . .
. / . | . . . | . . .
. / . | . . . | . . .

• finned Mutant X-wing: r2c2\c5b1, with fin = r5c2
• finned Mutant X-wing: r2c2\r5b1, with fin = r2c5
• eel 2\3: r2c2\r5c5b1
Code: Select all
. . . | . . . | . . .
/ . / | / . / | / / /
. . . | . . . | . . .
-------+-------+------
/ . / | . . . | . . .
. . . | . * . | . . .
/ . / | . . . | . . .
-------+-------+------
. . . | . . . | . . .
. . . | . . . | . . .
. . . | . . . | . . .

• finned Franken X-wing: r2b4\c25, with fin in cells r5c13
• finned Mutant X-wing: r2b4\r5c2, with fin = r2c5
• eel 2\3: r2b4\r5c25

none of them comes close to your own marvelous example --

Pat

Posts: 3990
Joined: 18 July 2005

This idea does look interesting, but I can't find the thread where you define what you mean by base and cover in this context. Maybe someone can enlighten me?
ab

Posts: 451
Joined: 06 September 2005

### "base" and "cover"

ab wrote:This idea does look interesting, but I can't find the thread where you define what you mean by base and cover in this context. Maybe someone can enlighten me?

The Ultimate FISH Guide should provide all the "fish" terminology

"base" and "cover" —
for any specific digit,
a "fish" of order j
is defined by a "base" of j units
and a "cover" of j units,

where the observation is —
A. each unit of the "base" can only have the digit somewhere in the "cover", and
B. the digit cannot occur in the overlap of units of the "base" [ new for Franken and Mutant ]

thus we know that the "base" will provide the digit j times in the "cover",
and the conclusion is —
exclude the digit in the "cover" outside the "base"

beyond the "fish" exclusion,
if there's overlap in the "cover" [ i.e. new for Franken and Mutant ]
we have an extra type of exclusion —
exclude the digit in the overlap of units of the "cover";

Obi-Wahn's idea extends this new type of exclusion
by considering order j\J,
where the "cover" is increased to J units ( j < J )

Pat

Posts: 3990
Joined: 18 July 2005

### two-finned examples

in all the above examples,
the "cover" is one unit larger than the "base" ( j + 1 = J ),
and the exclusions are:
in the overlap of units of the "cover"
and not in "base".

it is also possible to increase the "cover" to two unit larger than the "base" ( j + 2 = J ),
then the exclusions are:
in the overlap of (at least) 3 units of the "cover"
and not in "base".

Pat

Posts: 3990
Joined: 18 July 2005

My N\N variant on Obi-Wahn's arithmetic.

1) Take an N\N pattern and create the Base/Cover counts for each cell.

Code: Select all
mutant Starfish r37c7b35\r6c458b1
*-----------------------------------------------*
|  0/1 0/1 0/1  |  0/1 0/1 0/0  |  2/0 1/1 1/0  |
|  0/1 0/1 0/1  |  0/1 0/1 0/0  |  2/0 1/1 1/0  |
|  1/1 1/1 1/1  |  1/1 1/1 1/0  |  3/0 2/1 2/0  |
|---------------+---------------+---------------|
|  0/0 0/0 0/0  |  1/1 1/1 1/0  |  1/0 0/1 0/0  |
|  0/0 0/0 0/0  |  1/1 1/1 1/0  |  1/0 0/1 0/0  |
|  0/1 0/1 0/1  |  1/2 1/2 1/1  |  1/1 0/2 0/1  |
|---------------+---------------+---------------|
|  1/0 1/0 1/0  |  1/1 1/1 1/0  |  2/0 1/1 1/0  |
|  0/0 0/0 0/0  |  0/1 0/1 0/0  |  1/0 0/1 0/0  |
|  0/0 0/0 0/0  |  0/1 0/1 0/0  |  1/0 0/1 0/0  |
*-----------------------------------------------*

2) Compute Cover-Base for each cell.

Code: Select all
mutant Starfish r37c7b35\r6c458b1
*-----------------------------------------------*
|  +1  +1  +1   |  +1  +1   0   |  -2   0  -1   |
|  +1  +1  +1   |  +1  +1   0   |  -2   0  -1   |
|   0   0   0   |   0   0  -1   |  -3  -1  -2   |
|---------------+---------------+---------------|
|   0   0   0   |   0   0  -1   |  -1  +1   0   |
|   0   0   0   |   0   0  -1   |  -1  +1   0   |
|  +1  +1  +1   |  +1  +1   0   |   0  +2  +1   |
|---------------+---------------+---------------|
|  -1  -1  -1   |   0   0  -1   |  -2   0  -1   |
|   0   0   0   |  +1  +1   0   |  -1  +1   0   |
|   0   0   0   |  +1  +1   0   |  -1  +1   0   |
*-----------------------------------------------*

3a) Using the results from step (2), examine the candidate grid from your PM.
3b) Any candidate cell with a minus value must be empty or treated as a fin cell.
3c) Any candidate cell with a plus value can be eliminated -- provided it's seen by all fin cells.

Code: Select all
candidate grid from PM
*-----------------------------------*
| -1  .  .  | -1  .  .  | #1  1  .  |
|  1  .  .  |  1  .  1  |  .  1  .  |
|  .  1  1  |  1  1  .  |  .  .  .  |
|-----------+-----------+-----------|
|  1  1  .  |  1  .  .  |  .  .  .  |
|  .  .  1  |  .  .  .  |  .  .  1  |
|  .  .  .  |  1  .  1  |  1  .  1  |
|-----------+-----------+-----------|
|  .  .  .  |  .  1  .  |  .  1  .  |
|  1  1  .  |  1  .  .  |  .  1  1  |
|  .  1  1  |  .  .  1  |  .  .  .  |
*-----------------------------------*

Note: Nothing in this process prevents remote fin cells from existing. They just see the elimination cells indirectly!
daj95376
2014 Supporter

Posts: 2624
Joined: 15 May 2006

daj95376 wrote:Obi-Wahn needs to add +r1r1 to the Cover set in order to match it.

I just reread Obi-Wahn's rules and don't see that as one of his requirements. On what are you basing that idea?
ronk
2012 Supporter

Posts: 4764
Joined: 02 November 2005
Location: Southeastern USA

ronk wrote:I just reread Obi-Wahn's rules and don't see that as one of his requirements. On what are you basing that idea?

Obi-Wahn wrote:Construction rule: We have a Fish pattern if we can construct two sets of sectors, a base set and a cover set, in such a way that every candidate of a given digit belongs to at least as many cover sectors as it belongs to base sectors.

Obi-Wahn wrote:Exclusion rule: Any candidate of the digit in question, whose individual excess number of cover sectors is greater than the number of fin sectors in the pattern, can be eliminated.

Obi-Wahn wrote:Now every cell with a negative number must be empty, because a candidate there would violate the construction rule.

Now, since [r1c7] has a value of '-2' but is not empty in the candidate grid, then this cell must be covered with two Cover sectors to meet Obi-Wahn's construction rule. Since [c7] and [b3] are in the Base sectors, that only leaves adding [r1] twice to the Cover set! This changes [r1]'s counts to

Code: Select all
|  +3  +3  +3   |  +3  +3  +2   |   0  +2  +1   |

with two fin sectors and allows eliminations in all cells with a value of +3 or better -- which still matches my eliminations.
daj95376
2014 Supporter

Posts: 2624
Joined: 15 May 2006

daj95376 wrote:Now, since [r1c7] has a value of '-2' but is not empty in the candidate grid, then this cell must be covered with two Cover sectors to meet Obi-Wahn's construction rule. Since [c7] and [b3] are in the Base sectors, that only leaves adding [r1] twice to the Cover set!

I suppose Obi-Wahn's rules might have been intended for an endo-fin cell too, but he never specifically mentions "endo-fin" or "overlap", so I'm skeptical. Before being covered, an endo-fin cell will usually have a count of "-2" ("-3" is also possible) and while I recall endo-finned examples by Obi-Wahn, I don't recall a single example where he listed the same fin sector twice.

There is no requirement for an endo-fin cell to be covered more than once, so it's count can be "adjusted" to "-1".
ronk
2012 Supporter

Posts: 4764
Joined: 02 November 2005
Location: Southeastern USA

ronk wrote:There is no requirement for an endo-fin cell to be covered more than once, so it's count can be "adjusted" to "-1".

If we follow all of Obi-Wahn's rules, perform his arithmetic, and follow his interpretation on the resulting values, then it'll take the following N\(N+2) pattern to get [r1c14]<>1 for my candidate grid.

Code: Select all
mutant Starfish r37c7b35\r6c458b1+r1r1
daj95376
2014 Supporter

Posts: 2624
Joined: 15 May 2006

daj95376 wrote:If we follow all of Obi-Wahn's rules, perform his arithmetic, and follow his interpretation on the resulting values, then it'll take the following N\(N+2) pattern to get [r1c14]<>1 for my candidate grid.

Code: Select all
mutant Starfish r37c7b35\r6c458b1+r1r1

I think literal application of Obi-Wahn's rules would fail to find all three eliminations for the single fish shown below. I tend to "read between the lines.", so that makes me a bad proofreader, I suppose.

Code: Select all
*  *  * |  X *X  X |  * **  *
.  .  . |  /  X  / |  *  .  .
.  .  . |  /  X  / |  *  .  .
---------+----------+----------
*  *  * |  .  *  . |  *  .  .
X  X  X |  /  X  / |  X  /  /
X  X  X |  /  X  / |  X  /  /
---------+----------+----------
.  .  . |  .  *  . | **  .  .
.  .  . |  .  *  . | **  .  .
/  /  / |  /  X  / |  X  #  /

mutant jellyfish r569b2\r1c57b4 plus fin r9c8, implies r1c8, r78c7<>X
[Illustration based on Fig 4V Inverse here]

A lone fin cell "covers" twenty cells, not eight, so it's a valid deduction.
ronk
2012 Supporter

Posts: 4764
Joined: 02 November 2005
Location: Southeastern USA

Yes, you are correct that Obi-Wahn's technique would require two fish to perform the eliminations in your finned pattern. One time he'd cover [r9c8] with +c8, and the next time he'd cover [r9c8] with +b9. He could not add +c8b9 because of his interpretation of the counts. (Fortunately, my N\N variant of his counting technique isn't plagued by this problem.)

Your eliminations occur in three possible finned mutant Jellyfish that eliminate [r1c8],[r78c7]. (I don't know how the eliminations compare for the un-finned mutant Jellyfish.)

Code: Select all
finned mutant Jellyfish r9b256\r14c57
finned mutant Jellyfish r9c46b6\r14c7b8
finned mutant Jellyfish r569b2\r1c57b4

Note: There's also a finned franken Swordfish for [r78c7]<>X, and a finned franken Jellyfish for [r1c78]<>X. It just depends on personal preference.
daj95376
2014 Supporter

Posts: 2624
Joined: 15 May 2006

daj95376 wrote:Your eliminations occur in three possible finned mutant Jellyfish that eliminate [r1c8],[r78c7]. (I don't know how the eliminations compare for the un-finned mutant Jellyfish.)

Code: Select all
finned mutant Jellyfish r9b256\r14c57
finned mutant Jellyfish r9c46b6\r14c7b8
finned mutant Jellyfish r569b2\r1c57b4

Note: There's also a finned franken Swordfish for [r78c7]<>X, and a finned franken Jellyfish for [r1c78]<>X. It just depends on personal preference.

What is the ... finned franken Jellyfish for [r1c78]<>X?

[edit: Duh, I was looking for a swordfish instead of a jellyfish. I now see ... ]
Code: Select all
finned franken jellyfish c469b7\r478+r1b3 ==> r1c78<>X

I agree on the others, but those jellyfish look mighty neked without either "plus fin r9c8" or "+c8b9."
ronk
2012 Supporter

Posts: 4764
Joined: 02 November 2005
Location: Southeastern USA

### Re: About the arithmetic of Ultimate Fish

During recent discussions with StrmCkr about the following ronk exemplar, StrmCkr pointed out that an additional elimination was present from the Nx(N+1) Fish perspective.

Code: Select all
*  *  * |  X *X  X |  * **  *
.  .  . |  /  X  / |  *  .  .
.  .  . |  /  X  / |  *  .  .
---------+----------+----------
*  *  * |  .  *  . |  *  .  .
X  X  X |  /  X  / |  X  /  /
X  X  X |  /  X  / |  X  /  /
---------+----------+----------
.  .  . |  .  *  . | **  .  .
.  .  . |  .  *  . | **  .  .
/  /  / |  /  X  / |  X  #  /

mutant jellyfish r569b2\r1c57b4 plus fin r9c8, implies r1c8, r78c7<>X

When the unfinned mutant Jellyfish is processed using Obi-Wahn's arithmetic, then r1c7's count stands out from the general exemplar.

Code: Select all
unfinned mutant Jellyfish r569b2\r1c57b4
+-----------------------------------------------+
|   *   *   *   |   X  *X   X   |  +2   *   *   |
|   .   .   .   |   /   X   /   |   *   .   .   |
|   .   .   .   |   /   X   /   |   *   .   .   |
|---------------+---------------+---------------|
|   *   *   *   |   .   *   .   |   *   .   .   |
|   X   X   X   |   /   X   /   |   X   /   /   |
|   X   X   X   |   /   X   /   |   X   /   /   |
|---------------+---------------+---------------|
|   .   .   .   |   .   *   .   |   *   .   .   |
|   .   .   .   |   .   *   .   |   *   .   .   |
|   /   /   /   |   /   X   /   |   X   /   /   |
+-----------------------------------------------+

Now, let's add either [c8] or [b9] to create the following Nx(N+1) Fish containing r9c8.

Code: Select all
mutant Jellyfish r569b2\r1c57b4+c8  =>  r1c78<>X
+-----------------------------------------------+
|   .   .   .   |   X  +1   X   |  +2  +2   .   |
|   .   .   .   |   /   X   /   |   .   .   .   |
|   .   .   .   |   /   X   /   |   .   .   .   |
|---------------+---------------+---------------|
|   .   .   .   |   .   .   .   |   .   .   .   |
|   X   X   X   |   /   X   /   |   X   X   /   |
|   X   X   X   |   /   X   /   |   X   X   /   |
|---------------+---------------+---------------|
|   .   .   .   |   .   .   .   |   .   .   .   |
|   .   .   .   |   .   .   .   |   .   .   .   |
|   /   /   /   |   /   X   /   |   X   X   /   |
+-----------------------------------------------+

Code: Select all
mutant Jellyfish r569b2\r1c57b4+b9  =>  r178c7<>X
+-----------------------------------------------+
|   .   .   .   |   X  +1   X   |  +2   .   .   |
|   .   .   .   |   /   X   /   |   .   .   .   |
|   .   .   .   |   /   X   /   |   .   .   .   |
|---------------+---------------+---------------|
|   .   .   .   |   .   .   .   |   .   .   .   |
|   X   X   X   |   /   X   /   |   X   /   /   |
|   X   X   X   |   /   X   /   |   X   /   /   |
|---------------+---------------+---------------|
|   .   .   .   |   .   .   .   |  +2   .   .   |
|   .   .   .   |   .   .   .   |  +2   .   .   |
|   /   /   /   |   /   X   /   |   X   X   X   |
+-----------------------------------------------+

In both cases, r1c7 is included in the eliminations.
daj95376
2014 Supporter

Posts: 2624
Joined: 15 May 2006

daj95376 wrote:During recent discussions with StrmCkr about the following ronk exemplar,
StrmCkr pointed out that an additional elimination was present from the Nx(N+1) Fish perspective.

Code: Select all
*  *  * |  X *X  X |  * **  *
.  .  . |  /  X  / |  *  .  .
.  .  . |  /  X  / |  *  .  .
---------+----------+----------
*  *  * |  .  *  . |  *  .  .
X  X  X |  /  X  / |  X  /  /
X  X  X |  /  X  / |  X  /  /
---------+----------+----------
.  .  . |  .  *  . | **  .  .
.  .  . |  .  *  . | **  .  .
/  /  / |  /  X  / |  X  #  /

mutant jellyfish r569b2\r1c57b4 plus fin r9c8, implies r1c8, r78c7<>X

When the unfinned mutant Jellyfish is processed using Obi-Wahn's arithmetic,
then r1c7's count stands out from the general exemplar.

---r1c7 is included in the eliminations.

cute. of course r1c7 can be excluded by a smaller finned fish,
b256\r4c57 with a fin in r1c46

Pat

Posts: 3990
Joined: 18 July 2005

Next