Grid Transformations.

Programs which generate, solve, and analyze Sudoku puzzles

Re: Grid Transformations.

Postby StrmCkr » Tue Apr 30, 2024 4:24 pm

Yzfs has transformatioms as well, as does my pascal solver command command prompt not sure how well either works on Linux.

Either way Not sure how helpful that is for you eleven
Some do, some teach, the rest look it up.
stormdoku
User avatar
StrmCkr
 
Posts: 1427
Joined: 05 September 2006

Re: Grid Transformations.

Postby champagne » Tue Apr 30, 2024 5:45 pm

I tested the same method on the last example


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


showing digit patterns

Code: Select all

V1 bands        V1 stacks           V2 bands        V2 stacks
123456789       123456789           123456789       123456789

123......       1...5.7..           123......       .2..56...
.2.45....       .2...6..9           ....5.7.9       ..345.... 
1..4.6...       .234.....           ...4.6..9       .2.4...8.

6 digits        8 digits            8 digits         6 digits
_______________________________________________________________

.....678.       .2.4.6...           12.4.....        1.....78.
.....678       .1..4...8.           ...45..8.        1.....78.
.2....7.9.      .....678.           .23.5....        1...5...9

5 digits        6 digits            6 digits         5 digits
______________________________________________________________

...45...9       ..3....89           1.....78.        .2...6..9
1.3.....9       ..3.5.7..           ..3..6.8.        ..3..67..
..3.5..8.       1...5...9           .....67.9        ..34....9.

6 digits        6 digits            6 digits        6 digits     


we must have a swap bands/stacks in V2 to meet the distribution in V1
digit 8, missing in v1s1 and v2b1 will stay unchanged in the morphing.
This forces a swap band2 band 3 before the swap bands/ stacks
and a swap band1 band3 after the swap bands stack to match the "8" at band/stack level


V2 after swap bands 2,3 then diagonal swap, then swap bands 1,3
Code: Select all
 +-------+-------+-------+ 
 | . 9 . | . 6 . | 2 . . |   
 | . . 6 | 7 . . | . . 3 |     
 | 3 . . | . . 9 | . 4 . |   
 +-------+-------+-------+     
 | . 7 . | . 8 . | 1 . . |   
 | 1 . . | . . 7 | . 8 . |     
 | . . 9 | 1 . . | . . 5 |     
 +-------+-------+-------+
 | 2 . . | . . 6 | . 5 . |     
 | . 5 . | . 3 . | 4 . . |     
 | . . 4 | 8 . . | . . 2 |   
 +-------+-------+-------+ 

now all boxes are at the right place.

And now the mapping is easy, starting with "singles"
v2-1=> v1-7 in bands with 5 digits and v2-7 => v1--6 with "8" unchanged
then v2-6 => v1-4 in stack2

and a first relabeling status

Code: Select all
123456789  v2
7....468.  v1


Now several possibilities to finish the relabeling as

in box 4 v2-9=>v1-2
then in box 1 v2-3 => v1-1
then in box 6 v2-5 => v1-9
v2r1 => v1r2 => v2-2 => v1-5
and the last v2-4 => v1-3

Final relabeling

Code: Select all
123456789  v2
751394682  v1


and boxes 159 in V2 to morph to the same boxes in V1
champagne
2017 Supporter
 
Posts: 7384
Joined: 02 August 2007
Location: France Brittany

Re: Grid Transformations.

Postby eleven » Tue Apr 30, 2024 10:42 pm

eleven wrote:But when we compare full grids, this probably would become a torture.

.. but i could do it.
It's clear, that we have to concentrate on mini-rows/cols/diagonals, because they cannot fall apart.
After staring long enough at the 2 solution grids, i found that only 148 in band 3 are always in mini diagonals:
Code: Select all
+-------+-------+-------+   +-------+-------+-------+
| 1 8 7 | 2 5 9 | 3 4 6 |   | 2 9*6 | 5 1 8 | 7 4 3 |
| 6 2 9 | 3 4 1 | 7 5 8 |   |*3 5 1 | 7 4 6 | 9 2 8 |
| 3 5 4 | 8 7 6 | 2 9 1 |   | 7*8 4 | 3 2 9 | 5 6 1 |
+-------+-------+-------+   +-------+-------+-------+
| 7 3 5 | 6 9 4 | 8 1 2 |   |*8 4 9 | 1 3 7 | 2 5 6 |
| 9 6 1 | 5 8 2 | 4 7 3 |   | 5 7*3 | 6 8 2 | 1 9 4 |
| 8 4 2 | 1 3 7 | 5 6 9 |   | 1*6 2 | 4 9 5 | 8 3 7 |
+-------+-------+-------+   +-------+-------+-------+
| 5*1 6 |*4 2 3 | 9*8 7 |   | 4 2*8 | 9 6 1 | 3 7 5 |
| 2 9*8 | 7*1 5 | 6 3*4 |   | 9*3 7 | 8 5 4 | 6 1 2 |
|*4 7 3 | 9 6*8 |*1 2 5 |   |*6 1 5 | 2 7 3 | 4 8 9 |
+-------+-------+-------+   +-------+-------+-------+

And so are 368 in stack 1 of the right grid 148->368 (1)
looking at repeating pairs in mini-rows (left band 3): 15,89,34
looking at repeating pairs in mini-cols (right stack 1):23,58,67
Whats left ? 267 here, with only 26 in a column, 197 there, with only 79 in a row.
=> box8 -> box 7 (after reflection 2nd diagonal), 7->1 (-> band 2-> band 3) 26->79, 49 -> 56 => (1) 4->6, 9->5
looking at repeating pairs in mini-columns: 38, leaving 652 in box 789
looking at repeating pairs in mini-rows: 48, leaving 792 in box 123 => 38->48
since box8 goes to box 7: 5->2, 17->13 => 1->3
since 715 goes to 132, 423/968 must go to 694/578 in that order = 4->6,2->9,3->4,9->5,6->7,8->8
So we got all digit cycles, and the transformations reflection 2 (sub diagonal), band 2->3, col1 <-> 3.
Then box 9 must go to box 4, box 7 to box 1, box 5 to box 8, box 2 -> box 9, box 3 to box 6 and box 6 to box 5.

(and yes, i am sure , someone can post grids, where it is harder, but i spent enough time on that topic).
eleven
 
Posts: 3106
Joined: 10 February 2008

Previous

Return to Software