I am coding for Simple Fish strategies (i.e., X-Wing, Swordfish and Jellyfish). However, testing below Sudoku grid, taken from here, for X-Wing:
- Code: Select all
000000094760910050090002081070050010000709000080031067240100070010090045900000100
After two hidden pairs and one naked pair detected, Sudoku grid look like:
- Code: Select all
+-------------------+----------------------+-----------------+
| 1358 235 12358 | 3568 678 35678 | 67 9 4 |
| 7 6 48 | 9 1 48 | 23 5 23 |
| 345 9 345 | 3456 467 2 | 67 8 1 |
+-------------------+----------------------+-----------------+
| 346 7 23469 | 2468 5 468 | 23489 1 2389 |
| 13456 235 123456 | 7 2468 9 | 23458 23 238 |
| 45 8 2459 | 24 3 1 | 2459 6 7 |
+-------------------+----------------------+-----------------+
| 2 4 3568 | 1 68 3568 | 389 7 3689 |
| 368 1 3678 | 2368 9 3678 | 238 4 5 |
| 9 35 35678 | 234568 24678 345678 | 1 23 2368 |
+-------------------+----------------------+-----------------+
In next step, My program detect Row wise Jellyfish for Candidate 2 at r2468c3479. But above mentioned site detect:
- Code: Select all
X-Wing
(Row->Col) 2 taken off r5c2, based on r59c58
(Row->Col) 2 taken off r5c3, based on r59c58
(Row->Col) 2 taken off r5c7, based on r59c58
(Row->Col) 2 taken off r5c9, based on r59c58
(Row->Col) 2 taken off r9c4, based on r59c58
(Row->Col) 2 taken off r9c9, based on r59c58
Let me tell you about my simple fish strategy logic. After calculating digit and line (row/column) wise column/row places, search all three simple fish for each tuple combination. The logic used for searching simple fish is same as searching naked/hidden tuple.
Is there anything wrong in my logic?
Note: I skip line (row or column) checking:
For X-wing:
- if bit count of first tuple cell is not equals to 2; or
- if first tuple cell is not equals to second tuple cell
- Code: Select all
if (B[k[T[y][0]]] != 2 || k[T[y][0]] != k[T[y][1]])
For Swordfish:
- if bit count of either first, second or third tuple cell is less than 2; or
- if bit count of union of first, second and third cells is greater than 3
- Code: Select all
if (B[k[T[y][0]]] < 2 || B[k[T[y][1]]] < 2 || B[k[T[y][2]]] < 2 || B[k[T[y][0]] | k[T[y][1]] | k[T[y][2]]] != 3)
For Jellyfish:
- if bit count of either first, second, third or forth tuple cell is less than 2; or
- if bit count of union of first, second, third and forth cells is greater than 4[code]if (B[k[T[y][0]]] < 2 || B[k[T[y][1]]] < 2 || B[k[T[y][2]]] < 2 || B[k[T[y][3]]] < 2 || B[k[T[y][0]] | k[T[y][1]] | k[T[y][2]] | k[T[y][3]]] != 4)
Also, skip if no elimination occurs.
Waiting for expert support.
R. Jamil