Twin Empty Rectangles

Advanced methods and approaches for solving Sudoku puzzles

Twin Empty Rectangles

Postby pjb » Fri Jan 14, 2022 10:36 pm

Dale drew my attention to a YouTube video by Simon Anthony https://www.youtube.com/watch?v=fjWOgJqRWZI "Cracking the cryptic", where Simon describes what he believes is a new technique. While he described it as being an extension of empty rectangles, it seems to me to be more related to mutant swordfishes. On checking through a random selection of puzzles in the SE 5-8 range, it turns out to be a very common and therefore useful pattern.

The first of these two exemplars represents the rcb/rcb mutant swordfish, or otherwise a grouped continuous loop. In contrast however, in the second exemplar, there is no longer a continuous loop and the row and column eliminations are no longer justified. However, the potential eliminations in box 9 persist. If X is true in row 2 in box 1, then the X at r2c8 is false, and the X at r8c8 is true. If instead the X is true in column 2 in box 1, then the X at r8c2 is false and the X at r8c8 is true. So, wherever X is true in box 1, X is true at r8c8.

Fig 1

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


Fig2

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


X = base candidate, which may be missing
/ = empty cell, a cell that may not have an "X" candidate
* = potential eliminations


When the intersecting lines in box 9 contain more than one candidate, things get more complicated. Whenever there is an X in the intersection, ie r8c8 in above example, the continuous loop fails, and the eliminations in the cells in box 9 excepting those in row 8 and colun 8 persist. Whenever there is no X candidate in the intersection cell, there has to be X candidates in row 8 and column 8 forming a "hinge". In this situation a continuous loop (mutant swordfish) exists. Thus the deciding factor is the presence of a candidate in the intersecting cell.

Examples with a candidate in intersecting cell

Code: Select all
.4...9..7...2...91..8.7..36..2..76..7.......9.6.1...8.68..3.1..25.7....33....4...
.12...3..4.5.6....76.8.......89..1...5..7..9......4..23..2..4......9..7......1..3
.12.3....4.5...2..36.2.......76..1..8....7.5.....8...9.2.9..3......1..6......5..7
3.8.61..9..6...3...4.5...765...8.6..6..3.5..4..3.1...219...7.6...5...7..8..69.1.5
47.....2.93.42...78125.734.364.72.8.129845673587...4.2741.532.82587...3.6932..75.
1...2.3...3...4..5..63...4...2.4.1..6..5....7.1...7...8..9....2..5....9..2..7.8.6
.237....68...6.59.9.....7......4.97.3.7.96..2.........5..47.........2....8.......
1..9...2..4..6...8..5..1....2..3...95..7.......6..48...5..9..1......2..7..3...6..
...564....4.....1.3...9...67..94...1..4.5.2..9...12..58...7...9.6.....7....628...
....514....1.2..9..7...6.5.24....3.51.......75.7....84.1.5...4..9..6.8....231....
....6..878...2..5.75.8......8.5....9..4...7..1....4.6......8.13.6..3...423..5....
..5.4..6.7.....2...94.....8...8374..8...9...6..2164...5.....93...1.....2.3..8.6..
..52386...........1.......8.8..4..2.6.......7.23...18....9.4...9.4...8.53.28.59.1


Examples without a candidate in intersecting cell

Code: Select all
.....1..2....3..14...54.63...57.6....27.8...68..9.......9....6..82...9..37..9...8
5.2...1.9.6.....3...83.57.....4.6....7.812.6.6.......841.....83.........3...5...1
1.......2.3.4..5....6....1..4.37.......8.5..9....24....8....3....2....7.9...6...1
8.....6.1.651...8.2....4.5...92.1.7.....5.....8.9.32...5.3....2.1...579.6.2.....3
..5...3...8.....9.9...6.......4.3.7.5.1...8.2.4.8.5.......9...5.1.....6...3...7..
38.26...4..2.9.....6....3...5...3..8.9.....7.2..7...3...7....2.....2.9..8...17.43
..2...1..415...6387.......46...5...9.8..3..7...79.18......2....3.8.7.4.5...4.3...
.8.7...2.6......4...26.17.9..4..6.383..5.8..282.1..4..9.84.72...1......4.4...2.6.
.531...6......7..84...6.....2.5..8..6.9...7.3..7..3.2.....8...52..7......9...614.
...2.4...3..869..1.........564...123..2...8..7...4...58..1.5..9.5.....8.....2....
7.........829....3.96...8..9..58.1.6..7.6.4..6.5.24..8..9...35.2....564.........2
95.7...3...78.4..2......7..82......6...1.2...6......57..4......7..6.34...3...7.29


Dale and I thought "Twin ERs" might be a suitable name for it. I haven't noticed anyone using this strategy in the puzzle section of the Player's forum.
Even so, I am interested to know if the strategy has previously been described, perhaps under a different name.

Phil
Last edited by pjb on Sat Jan 15, 2022 1:38 am, edited 1 time in total.
pjb
2014 Supporter
 
Posts: 2567
Joined: 11 September 2011
Location: Sydney, Australia

Re: Twin Empty Rectangles

Postby StrmCkr » Fri Jan 14, 2022 11:41 pm

they aren't new at least as far as I'm and many on here probably are concerned,

they are sword fish pattern covered in the U.F.G

these where also covered explicitly under an Empty Rectangle Intersection {ERI} thread i had on the original forum predating the crash and rebuild.

unfortunately that thread is lost as we didn't have back ups for a 4-6 month window and many threads are lost from this rebuilt forum.
what it had in it was all generated patterns for all applicable ER patterns and all its extensions.

most of it was not worth my time rebuilding it as it fell under the UFG and had very little attention as all patterns for fish really didn't need propagated

the thing that did come out of that thread that i have attempted to keep alive is the ERI"S concept for chain building and how to use ER to link around corners
the ERI is what i call the middle cell of an empty rectangle to use it as a strong link it must be empty.

Code: Select all
| . x . |
| x * x |
|. x . |


use full for advance chain building.

the thread did contain many things up to monstrosity like this
Code: Select all
+----------------+----------------+----------------+
| .    (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    .   | .    (1)   .   | .    (1)   .   |
| -1   -1    -1  | (1)  (-1)  (1) | (1)  (-1)  (1) |
| .    -1    .   | .    (1)   .   | .    (1)   .   |
+----------------+----------------+----------------+

Code: Select all
+----------------+---------+--------------+
| .    (1)   .   | .  .  . | .   .     .  |
| (1)  (1)   (1) | .  .  . | .   (-1)  .  |
| .    (1)   .   | .  .  . | .   .     .  |
+----------------+---------+--------------+
| .    .     .   | .  .  . | .   .     .  |
| .    .     .   | .  .  . | .   .     .  |
| .    .     .   | .  .  . | .   .     .  |
+----------------+---------+--------------+
| .    .     .   | .  .  . | -1  .     -1 |
| .    (-1)  .   | .  .  . | .   (+1)  .  |
| .    .     .   | .  .  . | -1  .     -1 |
+----------------+---------+--------------+

figure 2 is dual overlapped ERI's {siameased}

the overlapping Box "9" digit ends up being true.

backing up the overlap you'll find it looks like these
a pattern ive refereed to as a "crab"
Code: Select all
+----------------+------------+--------------+
| .    (1)   .   | .   .   .  | .    .    .  |
| (1)  (-1)  (1) | -1  -1  -1 | -1   (1)  -1 |
| .    (1)   .   | .   .   .  | .    .    .  |
+----------------+------------+--------------+
| .    -1    .   | .   .   .  | .    .    .  |
| .    -1    .   | .   .   .  | .    .    .  |
| .    -1    .   | .   .   .  | .    .    .  |
+----------------+------------+--------------+
| .    -1    .   | .   .   .  | -1   (1)  -1 |
| .    (1)   .   | .   .   .  | (1)  .    .  |
| .    -1    .   | .   .   .  | -1   .    -1 |
+----------------+------------+--------------+

Code: Select all
+---------------+-----------+-----------+
| .    (1)  .   | .  .  .   | .  .    . |
| (1)  (1)  (1) | .  .  -1  | .  (1)  . |
| .    (1)  .   | .  .  .   | .  .    . |
+---------------+-----------+-----------+
| .    .    .   | .  .  .   | .  .    . |
| .    -1   .   | .  .  -1  | .  (1)  . |
| .    .    .   | .  .  .   | .  .    . |
+---------------+-----------+-----------+
| .    .    .   | .  .  .   | .  .    . |
| .    (1)  .   | .  .  (1) | .  .    . |
| .    .    .   | .  .  .   | .  .    . |
+---------------+-----------+-----------+

naming roughly was
: 2 arms off an eri = dual
n ERI { more then 1 eri {n for the # of}
can have arms {dual if 2 that don't connect}
bridge/d {connecting points}
broken bridges { 2 bridges connected in a box}
Siamese if they became cannibalistic from an overlapping arm

2 ERI Bridged
Code: Select all
+----------------+------------+-------------+
| .    (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    .   | .   .   .  | .   .    .  |
+----------------+------------+-------------+

3 ERI's
Code: Select all
+---------------+---------+---------------+
| .    (1)  .   | .  .  . | .    .    .   |
| (1)  (1)  (1) | .  .  . | .    -1   .   |
| .    (1)  .   | .  .  . | .    .    .   |
+---------------+---------+---------------+
| .    (1)  .   | .  .  . | .    (1)  .   |
| (1)  (1)  (1) | .  .  . | (1)  (1)  (1) |
| .    (1)  .   | .  .  . | .    (1)  .   |
+---------------+---------+---------------+
| .    .    .   | .  .  . | .    .    .   |
| .    .    .   | .  .  . | .    .    .   |
| .    .    .   | .  .  . | .    .    .   |
+---------------+---------+---------------+

3 ERI Broken Bridge
Code: Select all
+----------------+--------------+----------------+
| .    (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)  .   | .    (1)   .   |
| .    -1    .   | -1  -1   .   | .    -1    .   |
+----------------+--------------+----------------+

I'll leave this with out flooding it with the hundreds of viable permutations and expansions

a few of the simpler ones are hidden in "hodoku" and can be turned on in preferences-> steps dual/Siamese and allow ers with 2 candidates
Some do, some teach, the rest look it up.
stormdoku
User avatar
StrmCkr
 
Posts: 1425
Joined: 05 September 2006

Re: Twin Empty Rectangles

Postby thelardoffear » Sat Jan 15, 2022 1:25 am

Fig2 in the top post doesn't work for me as shown.

In row 8, r8c2 or r8c8 is X.

If r8c8 is X then the *s can be eliminated.

If r8c2 is X then in box 1, r2c1 or r2c3 is X so r2c8 isn't X so r8c8 must be X in column 8 giving 2 Xs in row 8.

The pattern only works if at least one of r7c8 and r9c8 is an X instead.
thelardoffear
 
Posts: 20
Joined: 20 April 2021

Re: Twin Empty Rectangles

Postby pjb » Sat Jan 15, 2022 1:48 am

Hi thelardoffear

Let me try again. One of the X's in the ER (box 1) has to be true. If the X is in the mini row in box 1, then the X at r2c8 is false, and the one at r8c8 is true.
The same goes for the X being in the mini column in the ER, making the X at r8c2 false and the X at r8c8 true. Since The X in the ER must be in either the row or column, the X at r8c8 must be true. It follows then that the X's at r2c8 and r8c2 are both false. So it is not a valid argument to assume the X at r8c2 is true when in fact it can't be.

Hi StrmCkr

I'm quite familiar with the UFG, in particular the swordfish section, and the pattern I'm putting forward (Fig 2) is not there.

Phil
pjb
2014 Supporter
 
Posts: 2567
Joined: 11 September 2011
Location: Sydney, Australia

Re: Twin Empty Rectangles

Postby StrmCkr » Sat Jan 15, 2022 3:11 am

Hi StrmCkr

I'm quite familiar with the UFG, in particular the swordfish section, and the pattern I'm putting forward (Fig 2) is not there.


given that the UFG is a guide to help people identify fish or mayhaps program a fish finder it doesn't list every permutation and redacted forums.

i do assure you they are covered with in it.

Sashimi Mutant Swordfish: 1r8c8b1\r2c2b9 efr8c8 => b9p1379<>1
Finned Mutant Swordfish: 1 r8c8b1 r2c2b9 efr8c8 => r7c79,r9c79<>1

blr clean up finds the other 2 eliminations -> which is the nature of NxN fish

turning off "1 fish per elimination" shows the others in hudoku

Siamese Finned Mutant Swordfish: 1 r8c8b1 r2c2b3/r2c2b9 efr8c8 => r2c8,r7c79,r9c79<>1
Siamese Finned Mutant Swordfish: 1 r8c8b1 r2c2b7/r2c2b9 efr8c8 => r7c79,r8c2,r9c79<>1


as far as i know and have posted the patterns is on this forum more then once enough that hodoku has it programed in it way back in 2007

Dual Empty Rectangle: 1 in b1 (r28c8/r8c28) => r2c8,r8c2<>1 : heres the fish form <----------

Code: Select all
.---------------------------------.---------------------------------.---------------------------------.
| 23456789   123456789  23456789  | 123456789  123456789  123456789 | 123456789  23456789   123456789 |
| 123456789  123456789  123456789 | 123456789  123456789  123456789 | 123456789  123456789  123456789 |
| 23456789   123456789  23456789  | 123456789  123456789  123456789 | 123456789  23456789   123456789 |
:---------------------------------+---------------------------------+---------------------------------:
| 123456789  123456789  123456789 | 123456789  123456789  123456789 | 123456789  23456789   123456789 |
| 123456789  123456789  123456789 | 123456789  123456789  123456789 | 123456789  23456789   123456789 |
| 123456789  123456789  123456789 | 123456789  123456789  123456789 | 123456789  23456789   123456789 |
:---------------------------------+---------------------------------+---------------------------------:
| 123456789  123456789  123456789 | 123456789  123456789  123456789 | 123456789  23456789   123456789 |
| 23456789   123456789  23456789  | 23456789   23456789   23456789  | 23456789   123456789  23456789  |
| 123456789  123456789  123456789 | 123456789  123456789  123456789 | 123456789  23456789   123456789 |
'---------------------------------'---------------------------------'---------------------------------'


Dual Empty Rectangle : 1 in b1 connected by r8,c8 => r79c79,r2c8,r8c2 <> 1

from yzf's solver a well... Edit removed remark

the x-chain for it.
Code: Select all
Grouped X-Chain: 1r8c8 = r8c2 - r123c2 = r2c13 - r2c8 = 1r8c8 => r79c79,r2c8,r8c2<>1
Last edited by StrmCkr on Sat Jan 15, 2022 7:56 am, edited 2 times in total.
Some do, some teach, the rest look it up.
stormdoku
User avatar
StrmCkr
 
Posts: 1425
Joined: 05 September 2006

Re: Twin Empty Rectangles

Postby yzfwsf » Sat Jan 15, 2022 4:15 am

StrmCkr wrote: from yzf's solver a well... {which was based on hodoku}

Dual ER in Hodoku is not equivalent to Dual ER of my solver,you can check this state.
Code: Select all
:0000:x:3+2..8+9.6...94..2...5...+2..95..92.+3...38.+4...+2.4+2..65..2.+3..4.5...62..4..+48+5+61+3+9+27:714 121 721 134 335 737 838 746 849 879 981 782 785 189::


Below is my code, you can see if it is similar to hodoku?
Code: Select all
Function FindER(aa As Long) As Long
  Dim As ULong i,j,k,l,R,C,t(),GrpDel,pc(30),pd(20),nc,nd,xx,tt()
  Dim As CellMap ER,Link,Del,pbCover ,Link2 ,Fins
  Dim As ULong LinkID(18 To 26,11)= _
      {{3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 16, 17}, {3, 4, 5, 6, 7, 8, 9, 10, 11, 15, 16, 17}, {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, _
      {0, 1, 2, 6, 7, 8, 12, 13, 14, 15, 16, 17}, {0, 1, 2, 6, 7, 8, 9, 10, 11, 15, 16, 17}, {0, 1, 2, 6, 7, 8, 9, 10, 11, 12, 13, 14}, _
      {0, 1, 2, 3, 4, 5, 12, 13, 14, 15, 16, 17}, {0, 1, 2, 3, 4, 5, 9, 10, 11, 15, 16, 17}, {0, 1, 2, 3, 4, 5, 9, 10, 11, 12, 13, 14}}
  Dim ERI As Long, ll As Long, isDual As Long
  For k = 1 To 9
      For i = 18 To 26
          ER = CandMap(k) And GrpMap(i)
          If ER.Count < 2 OrElse Not IsER(ER, i, R, C) Then Continue For
          If ER.Count = 2 Then ER.ToArray tt()
          For xx = 0 To IIf(ER.Count = 2, 1, 0)
              If ER.Count = 2 Then
                  If xx = 0 Then R = C2RCB(tt(0), 0) : C = C2RCB(tt(1), 1) Else R = C2RCB(tt(1), 0) : C = C2RCB(tt(0), 1)
              End If
              ERI = R * 9 + C -9 : pbCover = GrpMap(R) Or GrpMap(C)
              For j = 0 To 11 '找强链
                  Link = CandMap(k) And GrpMap(LinkID(i, j))
                  If Link.Count <> 2 OrElse NSet(Link.Box) = 1 OrElse (Link And CellMap(ERI)).IsZero Then Continue For
                  Del = (Link And Not pbCover).intersect And CellMap(ERI) And CandMap(k) And Not Link : isDual = 0
                  If enableDual AndAlso j < 6 Then
                      For ll = 6 To 11
                          Link2 = CandMap(k) And GrpMap(LinkID(i, ll))
                          If Link2.Count <> 2 OrElse NSet(Link2.Box) = 1 OrElse (Link2 And CellMap(ERI)).IsZero Then Continue For
                          Exit For
                      Next
                      If ll < 12 Then
                          Del Or=  (Link2 And Not pbCover).intersect And CellMap(ERI) And CandMap(k) And Not Link2 : isDual = 1
                          Fins = (Link Or Link2) And Not pbCover And CandMap(k)
                          Del Or= Fins.InterSect And CandMap(k)
                          If NSet(Fins.Box) = 1 AndAlso Fins.Count = 2 Then
                              Del Or=  (GrpMap(R) Or GrpMap(C)) And CandMap(k) And Not (ER Or Link Or Link2)
                          End If
                      End If
                  End If
                  If isDual = 0 Then Link2 = CellMap()
                  If Del.IsZero Then Continue For
                  Del.ToArray tt() : nc = 0 : nd = 0
                  For l = 0 To UBound(tt)
                      pc(nc) = bkclr(IIf((Link Or Link2).HaveCell(tt(l)), Cannibalism, cToDel), tt(l), V2B(k)) : nc += 1
                      pd(nd) = delnber(0, tt(l), V2B(k)) : nd += 1
                  Next
                  ((Link Or Link2) And Not Del).ToArray tt()
                  For l = 0 To UBound(tt)
                      pc(nc) = bkclr(cNormal, tt(l), V2B(k)) : nc += 1
                  Next
                  ER.ToArray tt()
                  For l = 0 To UBound(tt)
                      pc(nc) = bkclr(cFins, tt(l), V2B(k)) : nc += 1
                  Next
                  memcpy @Hint.grid, @actgrid, SizeOf(puzzle)
                  ReDim Hint.ColorCands(nc -1)
                  memcpy @Hint.ColorCands(0), @pc(0), nc * SizeOf(ULong)
                  ReDim Hint.DealCands(nd -1)
                  memcpy @Hint.DealCands(0), @pd(0), nd * SizeOf(ULong)
                  Hint.Desc = IIf(isDual, "Dual ", "") + "Empty Rectangle : " + Str(k) + " in b" + Str(i -17) + " connected by " + HouseName(linkid(i, j)) + IIf(isDual, "," + HouseName(linkid(i, ll)), "") + " => " + Map2Str(Del) + " <> " + Str(k)
                  If aa = 0 Then
                      Return 1
                  Else
                      AllPathCnt += 1 : AllPathInOneStep(AllPathCnt) = Hint
                  End If
              Next
          Next
      Next
  Next
End Function
yzfwsf
 
Posts: 851
Joined: 16 April 2019

Re: Twin Empty Rectangles

Postby StrmCkr » Sat Jan 15, 2022 4:42 am

I know your solver is your own code I said was based on his as his code is open source and you have deffintly made a very Sweet solver and lots of improvements.

If it wasn't you wouldn't have specifically had a dual er function as he added them explicitly when I asked for it

your code isn't needed as proof that it's your own you have said it enough.

Anway my point being
figure 2 isn't something new that's all.
Some do, some teach, the rest look it up.
stormdoku
User avatar
StrmCkr
 
Posts: 1425
Joined: 05 September 2006

Re: Twin Empty Rectangles

Postby yzfwsf » Sat Jan 15, 2022 4:57 am

StrmCkr wrote:I know your solver is your own code I said was based on his as his code is open source and you have deffintly made a very Sweet solver and lots of improvements.

If it wasn't you wouldn't have specifically had a dual er function as he added them explicitly when I asked for it

your code isn't needed as proof that it's your own you have said it enough.

Anway my point being
figure 2 isn't something new that's all.

OK, it seems that I'm too sensitive. Thank you for your creativity. I wrote the Complex Death Blossom .
yzfwsf
 
Posts: 851
Joined: 16 April 2019

Re: Twin Empty Rectangles

Postby StrmCkr » Sat Jan 15, 2022 5:03 am

Complex Death Blossom & thanks for that it's helped me bug check my own code and sort out my errors :)
Some do, some teach, the rest look it up.
stormdoku
User avatar
StrmCkr
 
Posts: 1425
Joined: 05 September 2006

Re: Twin Empty Rectangles

Postby rjamil » Sun Jan 16, 2022 4:04 pm

Hi all,

For Fig 1 in OP, see here.
For Fig 2 in OP, see here.

R. Jamil
rjamil
 
Posts: 730
Joined: 15 October 2014
Location: Karachi, Pakistan


Return to Advanced solving techniques