## Strong Links & Weaklinks

Programs which generate, solve, and analyze Sudoku puzzles

### Strong Links & Weaklinks

Strong link
0). Bivalves cells {internal relation }
Code: Select all
`.  .  . | . AB . | . . . `

1).2 bi locals in a row/Col/Box
Code: Select all
`/  x  / | /  /  / | /  x  / `

2). 1 cell in Row/Col in a box with 2-3 cells in a same row/col in a box
Code: Select all
`/  x  / |  /  /  /  |  x  x  x `

3). 2-3 cell in Row/Col in a box with 1 cells in a same row/col in a box
Code: Select all
`x  x  x  |  /  /  /  |  /  x  / `

4). 2-3 cells in a row/col in a box with 2-3 cells in same row/col in a diffrent box
Code: Select all
`x  x  x  |  /  /  /  |  x  x  x `

5). Empty rectangle intersection {E.R.I} the sum of all digits in a box are found on 1 col and 1 row see Note at bottom of section
Code: Select all
`/ x / x * x/ x / `

Note:ERI's are an exception to a valid chain starting spot it can be used only if the center cell is absent as this leaves either the row or col true, the * cell is used as a pivot between row/col
Weak Links
exists in cells that are part of a strong link set, that see parts of another strong link sets without being part of it, or directly seeing all of it.
0,0). Bivalve that sees another bivalve with digit shared
Code: Select all
`.  .  . | . AB . | . . . .  .  . | . BC . | . . .`

0,1). Bivalve that sees 1 digit of bi-local digit
Code: Select all
`.  AB  . | .  .  . | .  .  . /  x   / | /  /  / | /  x  / `

0,2). Bivalve that sees the 1 cell in Row/Col in a box with 2-3 cells in a same row/col in a different box
Code: Select all
`.  AB  . | .  .  . | .  .  . /  x   / | /  /  / | x  x  x `

0,3). Bivalve that sees the 2-3 cells in Row/Col in a box with 1 cells in a same row/col in a different box
Code: Select all
`.  AB  . | .  .  . | .  .  . x  x   x | /  /  / | /  x  / `

0,4). Bivalve that sees the 2-3 cells in Row/Col in a box with 2-3 cells in a same row/col in a different box
Code: Select all
`.  AB  . | .  .  . | .  .  . x  x   x | /  /  / | x  x  x `

0,5). Bivalve that sees an ERI's * cell
Code: Select all
`.  AB  . | .  .  . | .  .  . ----------------------------/  x   / |x  *   x |/  x   / |`

1,0) a bi-local digit that 1 cell sees a bivalve
Code: Select all
`/  x   / | /  /  / | /  x  /.  AB  . | .  .  . | .  .  .`

1,1) a bi-local digit that 1 of the cells sees a bi-local digit
Code: Select all
`/  x   / | /  /  / | /  x  //  x   / | /  /  / | /  x  /`

1,2) a bi-local digit that 1 of the cells sees the 1 cell in Row/Col in a box with 2-3 cells in a same row/col in a different box
Code: Select all
`/  x   / | /  /  / | /  x  //  x   / | /  /  / | x  x  x`

1,3) a bi-local digit that 1 of the cells sees the 2-3 cells in Row/Col in a box with 1 cells in a same row/col in a different box
Code: Select all
`/  x   / | /  /  / | /  x  /x  x   x | /  /  / | /  x  /`

1,4) a bi-local digit that 1 of the cells sees all the 2-3 cells in Row/Col in a box with 2-3 cells in a same row/col in a different box
Code: Select all
`/  x   / | /  /  / | /  x  /x  x   x | /  /  / | x  x  x`

1,5) a bi-local digit that 1 of the cells sees the * cell of an ERI
Code: Select all
`/  x   / | /  /  / | /  x  /----------------------------/  x   / |x  *   x |/  x   / |`

2,0). 1 cell in Row/Col in a box with 2-3 cells in a same row/col in a different box, where the 1 cell sees the bivalve
Code: Select all
`/  x   / | /  /  / | x  x  x .  AB  . | .  .  . | .  .  . `

2,1). 1 cell in Row/Col in a box with 2-3 cells in a same row/col in a different box, where the 1 cell sees 1 cell of a bi local digit.
Code: Select all
`/  x   / | /  /  / | x  x  x /  x   / | /  /  / | /  x  /`

2,2). 1 cell in Row/Col in a box with 2-3 cells in a same row/col in a different box, where the 1 cell sees the "1" cell in Row/Col in a box with 2-3 cells in a same row/col in a different box
Code: Select all
`/  x   / | /  /  / | x  x  x /  x   / | /  /  / | x  x  x`

2,3). 1 cell in Row/Col in a box with 2-3 cells in a same row/col in a different box, where the 1 cell sees the "2-3" cell in Row/Col in a box with 1 cells in a same row/col in a different box
Code: Select all
`/  x   / | /  /  / | x  x  x x  x   x | /  /  / | /  x  /`

2,4). 1 cell in Row/Col in a box with 2-3 cells in a same row/col in a different box, where the 1 cell sees the "2-3" cell in Row/Col in a box with 2-3 cells in a same row/col in a different box
Code: Select all
`/  x   / | /  /  / | x  x  x x  x   x | /  /  / | x  x  x`

2,5). 1 cell in Row/Col in a box with 2-3 cells in a same row/col in a different box, where the 1 cell sees the * cell of an eri
Code: Select all
`/  x   / | /  /  / | x  x  x ----------------------------/  x  /  |x  *  x  |/  x  /  |`

3,0). the 2-3 cells in Row/Col in a box with 1 cells in a same row/col in a different box where the Bivalve that sees 2-3 cell.
Code: Select all
` x  x   x | /  /  / | /  x  / .  AB  . | .  .  . | .  .  .`

3,1) the 2-3 cells in Row/Col in a box with 1 cells in a same row/col in a different box where the bi-local digit that 1 of the cells sees 2-3 cells
Code: Select all
`x  x   x | /  /  / | /  x  //  x   / | /  /  / | /  x  /`

3,2). 3-2 cell in Row/Col in a box with 1 cell in a same row/col in a different box, where the 2-3 cell sees the "1" cell in Row/Col in a box with 2-3 cells in a same row/col in a different box
Code: Select all
`x  x   x | /  /  / | /  x  //  x   / | /  /  / | x  x  x `

3,3). 3-2 cell in Row/Col in a box with 1 cell in a same row/col in a different box, where the 2-3 cell sees the "2-3" cells in Row/Col in a box with 1 cell in a same row/col in a different box
Code: Select all
`x  x   x | /  /  / | /  x  /x  x   x | /  /  / | /  x  /`

3,4). 3-2 cell in Row/Col in a box with 1 cell in a same row/col in a different box, where the 2-3 cell sees the "2-3" cells in Row/Col in a box with 2-3 cell in a same row/col in a different box
Code: Select all
`x  x   x | /  /  / | /  x  /x  x   x | /  /  / | x  x  x`

3,5).
Code: Select all
` NO valid formation`

4,0). the 2-3 cells in Row/Col in a box with 2-3 cells in a same row/col in a different box where the 2-3 cell sees the Bivalve
Code: Select all
`x  x   x | /  /  / | x  x  x .  AB  . | .  .  . | .  .  . `

4,1) 2-3 cells in Row/Col in a box with 2-3 cells in a same row/col in a different box where a bi-local digit sees all of one boxes digits.
Code: Select all
`x  x   x | /  /  / | x  x  x/  x   / | /  /  / | /  x  /`

4,2). 2-3 cell in Row/Col in a box with 2-3 cells in a same row/col in a different box, where the (2-3) cell sees the "1" cell in Row/Col in a box with 2-3 cells in a same row/col in a different box
Code: Select all
`x  x   x | /  /  / | x  x  x/  x   / | /  /  / | x  x  x `

4,3). 3-2 cell in Row/Col in a box with 2-3 cell in a same row/col in a different box, where the 2-3 cell sees the "2-3" cells in Row/Col in a box with 1 cell in a same row/col in a different box
Code: Select all
`x  x   x | /  /  / | x  x  xx  x   x | /  /  / | /  x  /`

4,4). 3-2 cell in Row/Col in a box with 2-3 cell in a same row/col in a different box, where the 2-3 cell sees the "2-3" cells in Row/Col in a box with 2-3 cell in a same row/col in a different box
Code: Select all
`x  x   x | /  /  / | x  x  xx  x   x | /  /  / | x  x  x`

4,5).
Code: Select all
`no valid formation `

5,0). an ERI's * cell sees the Bivalve
Code: Select all
`/  x   / |x  *   x |/  x   / |----------------------------.  AB  . | .  .  . | .  .  . `

5,1) the * cell of an ERI sees the 1 of the bi-local digit
Code: Select all
`/  x   / |x  *   x |/  x   / |----------------------------/  x   / | /  /  / | /  x  /`

5,2). the * cell of an eri see the "1" digit in a row/col of a box with 2-3 cells in same row/col of a different box.
Code: Select all
`/  x  /  |x  *  x  |/  x  /  |----------------------------/  x   / | /  /  / | x  x  x `

5,3).
Code: Select all
` NO valid formation`

5,4).
Code: Select all
`no valid formation `

5,5). the * cell an ERI sees the * sell of a 2nd ERI
Code: Select all
`/  x  /  |x  *  x  |/  x  /  |----------------------------/  x  /  |x  *  x  |/  x  /  |`

.......work in progress........
Some do, some teach, the rest look it up. StrmCkr

Posts: 979
Joined: 05 September 2006

### Re: Strong Links & Weaklinks

what to do with all that data:

build an array
Links : = 1..9, 0..80 , 0..26, 0..5
for N [1..9] digits
for 0..80 cells
where each cell occupies 3 of the [0..26 ]sectors
and 0..5 of the strong link classes
pls see my solver for details on data sets used in the code below.
Strong link table building: Show
Code: Select all
`note: this code doesn't do eri's yet. procedure links;varn,xn,xn2,yn,g,h:integer;beginfor n:= 1 to 9 do for xn:= 0 to 80 do  for xn2 in ([Rx[xn]] + [(Cy[xn]+9)] + [(Bxy[xn]+18)]) do  for yn:= 0 to 5 do    linkset[n,xn,xn2,yn]:=[]; for n:= 1 to 9 do  for xn:= 0 to 80 do   {if (pm[xn] * [n] <> []) then}    for xn2 in ([Rx[xn]] + [(Cy[xn]+9)] + [(Bxy[xn]+18)]) do     if xn in Rnsectornum[xn2,n]       then  begin   {bi vavle}  If (nm[xn] = 2)   then     linkset[n,xn,xn2,0]:=linkset[n,xn,xn2,0] + (pm[xn] - [n]);  {bi local}   if ( sec[xn2,n] = 2)   then    linkset[n,xn,xn2,1]:=linkset[n,xn,xn2,1] + (Rnsectornum[xn2,n] - [xn]);     { single + grouped}       if  (sec[xn2,n] < 5)  AND (sec[XN2,N] > 2 )     then      for h in peerRCB[xn2] do       if ( [xn] + (Rnsectornum[xn2,n] * Rnsectornum[h,n]) = Rnsectornum[xn2,n] )  and ( [xn] * (Rnsectornum[xn2,n] * Rnsectornum[h,n] ) = [])        then         begin          linkset[n,xn,xn2,2]:=linkset[n,xn,xn2,2] + (Rnsectornum[xn2,n] - [xn]);            {grouped + single}           for G in (Rnsectornum[xn2,n] - [xn]) do            linkset[n,g,xn2,3]:=linkset[n,g,xn2,3] + [xn];          end;      {Grouped + grouped}    if  (Sec[xn2,n] > 4)  AND (Sec[XN2,N] < 7 )     then      for h in peerRCB[xn2]  do       begin       if  {(h in [18..26]) and} ( (Rnsectornum[Bxy[xn]+18,n]  * Rnsectornum[xn2,n]) + (Rnsectornum[xn2,n] * Rnsectornum[h,n]) = Rnsectornum[xn2,n] )        then          linkset[n,xn,xn2,4]:=linkset[n,xn,xn2,4] + ((Rnsectornum[h,n] * Rnsectornum[xn2,n]) - (Rnsectornum[Bxy[xn]+18,n]  * Rnsectornum[xn2,n])) ;       if  {(H in [0..8] ) and }( (Rnsectornum[Rx[xn],n]  * Rnsectornum[xn2,n]) + (Rnsectornum[xn2,n] * Rnsectornum[h,n]) = Rnsectornum[xn2,n] )        then          linkset[n,xn,xn2,4]:=linkset[n,xn,xn2,4] + ((Rnsectornum[h,n] * Rnsectornum[xn2,n]) - (Rnsectornum[Rx[xn],n]  * Rnsectornum[xn2,n])) ;       if {(H in [9..17] )and }( (Rnsectornum[Cy[xn]+9,n]  * Rnsectornum[xn2,n]) + (Rnsectornum[xn2,n] * Rnsectornum[h,n]) = Rnsectornum[xn2,n] )        then          linkset[n,xn,xn2,4]:=linkset[n,xn,xn2,4] + ((Rnsectornum[h,n] * Rnsectornum[xn2,n]) - (Rnsectornum[Cy[xn]+9,n]  * Rnsectornum[xn2,n])) ;       end;  end; writexy(2,60,'link list'); writeln; for n:= 1 to 9 do  for xn:= 0 to 80 do     for xn2 in ([Rx[xn]] + [(Cy[xn]+9)] + [(Bxy[xn]+18)]) do   for yn:= 0 to 4 do    if linkset[n,xn,xn2,yn] <> []     then     begin     gotoxy(2,61);      write( 'n: ',n,' xn: ',xn,' xn2: ',xn2,' yn: ',yn,' G: ');      for  g in linkset[n,xn,xn2,yn]  do       write(g,' ');       //delay(1500);       writeln;      end;end;`

Weak link table building: Show
Code: Select all
`procedure Wlinks;varn,xn,xn2,yn,yn2,g,h:integer;beginfor n:= 1 to 9 do for xn:= 0 to 80 do  for xn2 in ([Rx[xn]] + [(Cy[xn]+9)] + [(Bxy[xn]+18)]) do  for yn:= 0 to 5 do   for yn2:=0 to 5 do    wlinkset[n,xn,xn2,yn,yn2]:=[];   for n:= 1 to 9 do    for xn:= 0 to 80 do     for xn2 in ([Rx[xn]] + [(Cy[xn]+9)] + [(Bxy[xn]+18)]) do      for G in peer[xn] do        for h in  ([Rx[g]] + [(Cy[g]+9)] + [(Bxy[g]+18)]) do      begin        if (linkset[n,xn,xn2,0] <> [] )          and  (linkset[n,g,h,0] <> [])                then                 wlinkset[n,xn,xn2,0,0]:= wlinkset[n,xn,xn2,0,0] + [g];       for yn:=  1 to 4 do        for yn2:= 1 to 4 do          if (linkset[n,xn,xn2,yn] <> [])           and (linkset[n,g,h,yn2] <> [])            and  ( (linkset[n,g,h,yn2] + [g] )   * (linkset[n,xn,xn2,yn] + [xn] )  = [])            and( (Peer[xn] * Rnsectornum[h,n]) = (Rnsectornum[h,n] - linkset[n,g,h,yn2]) )            and( (peer[g] * Rnsectornum[xn2,n] ) = (Rnsectornum[xn2,n] - linkset[n,xn,xn2,yn] ))             then              begin                wlinkset[n,xn,xn2,yn,yn2]:=wlinkset[n,xn,xn2,yn,yn2] + [g];                wlinkset[n,g,h,yn2,yn]:=wlinkset[n,g,h,yn2,yn] + [xn];              end;       for yn:= 1 to 4 do        if (linkset[n,xn,xn2,0] <> [])        and (linkset[n,g,h,yn] <> [] )        and (linkset[n,g,h,yn] * [xn] <> [xn])         and (Peer[xn] * (Rnsectornum[h,n]) <>  rnsectornum[h,n])          then           begin            wlinkset[n,xn,xn2,0,yn]:=wlinkset[n,xn,xn2,0,yn] + [g];            wlinkset[n,g,h,yn,0]:=wlinkset[n,g,h,yn,0] + [xn];           end;       end; writexy(2,62,'weak link list'); writeln; for n:= 1 to 9 do  for xn:= 0 to 80 do     for xn2 in ([Rx[xn]] + [(Cy[xn]+9)] + [(Bxy[xn]+18)]) do   for yn:= 0 to 5 do    for yn2:=0 to 5 do    if wlinkset[n,xn,xn2,yn,yn2] <> []     then     begin     gotoxy(2,63);      write( 'n: ',n,' xn: ',xn,' xn2: ',xn2,' yn: ',yn,' yn2: ',yn2,' G: ');      for  g in wlinkset[n,xn,xn2,yn,yn2]  do       write(g,' ');       //delay(1500);       writeln;      end;end;`
Some do, some teach, the rest look it up. StrmCkr

Posts: 979
Joined: 05 September 2006

Return to Software