## Almost Locked Pair and Almost Locked Triple

Advanced methods and approaches for solving Sudoku puzzles

### Almost Locked Pair and Almost Locked Triple

I thought I would try to give some attention to two techniques. I am unsure of their lineage. They have been discussed on Asian forum(s) and more recently they have been discussed on this forum :

forum.enjoysudoku.com/help-almost-locked-candidates-move-t37339.html

A while back, yzfwsf added these techniques to his software, YZF_Sudoku. YZF_Sudoku is an excellent learning tool for human solvers and it has the largest number of techniques to date. It turns out that these two techniques pop up quite often in YZF_Sudoku's solution paths.

Here is an example of an Almost Locked Pair [ALP]:

6....7..4..45..7...9..4..8..8.2....3..3...2..5....3.1...1.9..6.4....51...6.3....2

Code: Select all
`.------------------.----------------------.-------------------.| 6     1235  258  | 189     1238   7     | 359   2359  4     || 1238  123   4    | 5       12368  12689 | 7     239   169   || 1237  9     257  | 16      4      126   | 356   8     156   |:------------------+----------------------+-------------------:| 179   8     679  | 2       1567   1469  | 4569  4579  3     || 179   147   3    | 146789  15678  14689 | 2     4579  56789 || 5     247   2679 | 46789   678    3     | 4689  1     6789  |:------------------+----------------------+-------------------:| 2378  2357  1    | 478     9      248   | 3458  6     578   || 4     237   2789 | 678     2678   5     | 1     379   789   || 789   6     5789 | 3       178    148   | 4589  4579  2     |'------------------'----------------------'-------------------'`

Consider the line r3 and the block b3. Since r3c4 is a bi-value cell [16], the mini-line r3b3 can contain at most one of {1, 6}. But now notice in the first two rows of b3, {1,6} appears only once [in r2c9] and so the mini-line r3b3 must contain at least one of {1,6}. The "at most" and the "at least" mean the the mini-line r3b3 must contain exactly one of {1,6}. We then see that r3c4 and r3b3 form what is often called a virtual locked pair. So, in the line r3, we can exclude {1} from r3c1 and r3c6 and we can exclude {6} from r3c6. In addition, since r2c9 must contain one of {1,6}, we can exclude {9} from r2c9.
It is true that these same exclusions can be seen from a Sue de Coq or and ALS-XZ but the ALP argument seems far easier to me. YZF_Sudoku rates ALP as 'Hard' [yellow] and I agree with this rating.

Now, let's consider an example of an Almost Locked Triple [ALT] :
5..9..3...3......4....6..8.1..4.2.....2.3.......5.67..6....98....8.....1.4.....3.
Code: Select all
`.--------------------.---------------------.----------------------.| 5     12678  1467  | 9      12478  1478  | 3      1267    267   || 2789  3      1679  | 1278   12578  1578  | 12569  125679  4     || 2479  1279   1479  | 1237   6      13457 | 1259   8       2579  |:--------------------+---------------------+----------------------:| 1     56789  35679 | 4      789    2     | 569    569     35689 || 4789  56789  2     | 178    3      178   | 14569  14569   5689  || 3489  89     349   | 5      189    6     | 7      1249    2389  |:--------------------+---------------------+----------------------:| 6     1257   1357  | 1237   12457  9     | 8      2457    257   || 2379  2579   8     | 2367   2457   3457  | 24569  245679  1     || 279   4      1579  | 12678  12578  1578  | 2569   3       25679 |'--------------------'---------------------'----------------------'`

Consider the line r5 and the block b6. In b6, the cells r4c7 and r4c8 contain only {5,6,9}, so r5b6 can contain at most one of {5,6,9}. But now notice that, in r5, {5,6,9} appear in only r5c1 and r5c2. So r5b6 must contain at least one of {5,6,9}. Again, the "at most" and the "at least" mean that the mini-line r5b6 must contain exactly one of {5,6,9}. This observation gives 10! exclusions. Again, these same exclusions can be seen from [the much harder to see] Sue de Coq or the ALS-XZ.

The ALT argument is the same as the ALP argument. ALT is certainly tougher to see than an ALP. Human solvers search for exclusions using the bi-value cells early in solving. The search for exclusions using ALS is certainly harder but the ALT seem among the easiest of ALS exclusions.

Notice, that with ALP, the bi-value cell can be in the line or the block. With ALT, the ALS can be in the line or the block. This is detailed in the forum post noted above.
ghfick

Posts: 221
Joined: 06 April 2016

### Re: Almost Locked Pair and Almost Locked Triple

Hello,

I came across this interesting post by creint on ALP.
In that post we have for

1...8659.8......2.........1.....7...5.6..4....9..58.....7.45..........6362.1..4..

Code: Select all
`+--------------+--------------+------------------+| 1   3   2    | 47  8   6    | 5    9   (47)    || 8   457 459  | 457 39  1    | 367  2   (467)   || 479 6   459  | 457 2   39   | 8   (347) 1      |+--------------+--------------+------------------+| 24  48  13   | 239 6   7    | 239  1345 24589  || 5   78  6    | 239 1   4    | 2379 37   2789   || 247 9   13   | 23  5   8    | 2367 1347 24-67  |+--------------+--------------+------------------+| 3   1   7    | 6   4   5    | 29   8    29     || 49  45  459  | 8   7   2    | 1    6    3      || 6   2   8    | 1   39  39   | 4   (57) (57)    |+--------------+--------------+------------------+`

1. ALP => -67 r6c9 [3 placements]

Placing 6 or 7 at r6c9 would imply no digit in r5c8. The cells involved in this observation are marked in the grid.
At that time, SpAce derived the following chain to justify the elimination -67 r6c9

(67=45)r129c9 - (4|5=2389'67)b6p134567 => -67 r6c9, -6 r2c7

(last elimination indicated by creint). I prefer a slightly different chain

(76=4)r12c9 - (4)r6c9 = (41-5)r46c8 = (5)r9c8 - (5=476)r912c9 => -67 r6c9, -6 r2c7

Current version of YZF_Sudoku gives

Code: Select all
`.---------------------------------------------------.| 1    3    2   | 47   8   6  | 5      9      47    || 8    457  459 | 457  39  1  |(37)-6  2      467   || 479  6    459 | 457  2   39 | 8      347    1     ||---------------+-------------+---------------------|| 24   48   13  | 239  6   7  |(3)29   145-3  24589 || 5    78   6   | 239  1   4  |(37)29 (37)    289-7 || 247  9    13  | 23   5   8  |(37)26  14-37  246-7 ||---------------+-------------+---------------------|| 3    1    7   | 6    4   5  | 29     8      29    || 49   45   459 | 8    7   2  | 1      6      3     || 6    2    8   | 1    39  39 | 4      57     57    |'---------------------------------------------------'`

Almost Locked Pair (37)r456c7,r2c7,r5c8 => -3 r4c8, -7 r56c9, -37 r6c8, -6 r2c7 (ste!)

I still cannot spot this move immediately (however the several pairs makes one aware that it is present somewhere).
One way I find it (manually) is reasoning as follows: we cannot have 3 pairs (29) in column 7, so

(3*)r45c7 - (3=7^)r5c8 - (7)r56c7 = (7#)r2c8
||
(7^)r5c7 - (7=3*)r5c8 - (3)r456c7 = (3#)r2c7

=> -3* r46c8, -7^ r56c9, -7^ r6c8, -6# r2c7

(another way would be writing a chain (loop))

If someone has another way (i.e., a reasoning) to get those eliminations using this pattern, I would be interested (thanks in advance).
Last edited by jco on Sat Feb 05, 2022 5:12 pm, edited 1 time in total.
JCO
jco

Posts: 655
Joined: 09 June 2020

### Re: Almost Locked Pair and Almost Locked Triple

If you use Xsudo's Rank logic, you can easily understand this technique.
3 Truths = {37c7 r5c8}
6 Eliminations --> r4c8<>3 r5c9<>7 r6c8<>37 r6c9<>7 r2c7<>6
yzfwsf

Posts: 716
Joined: 16 April 2019

### Re: Almost Locked Pair and Almost Locked Triple

ghfick wrote:I thought I would try to give some attention to two techniques. I am unsure of their lineage.

This technique comes from Xsudo, and the abbreviation in Xsudo is ALC，full name is Almost Locked Candidates.
ps:I'm not sure if it's wiki's earlier or xsudo's earlier.
yzfwsf

Posts: 716
Joined: 16 April 2019

### Re: Almost Locked Pair and Almost Locked Triple

Some do, some teach, the rest look it up.
stormdoku

StrmCkr

Posts: 1364
Joined: 05 September 2006

### Re: Almost Locked Pair and Almost Locked Triple

My solver finds Almost Locked Pairs by looking at a bivalue cell and a whole row, column or box, so gets the above eliminations as follows:

(R5C2) is not 7 - ALP: R5C8,Column 7,n=3,7 (from R5C8=3, R2C7=3, R6C7=6, R5C7=7)
(R5C9) is not 7 - ALP:
(R6C7) is not 7 - ALP:
(R6C8) is not 7 - ALP:
(R6C9) is not 7 - ALP:
(R4C8) is not 3 - ALP: R5C8,Column 7,n=7,3 (from R5C8=7, R2C7=7, R6C7=6, R4C7/R5C7=3)
(R6C7) is not 3 - ALP:
(R6C8) is not 3 - ALP:
(R2C7) is not 6 - ALP: R5C8,Column 7,n=3,7 (as R2C7 is always the first deduction)
thelardoffear

Posts: 20
Joined: 20 April 2021

### Re: Almost Locked Pair and Almost Locked Triple

Some solvers have this implemented:
Code: Select all
`ANS or ANS                        ALS-XZANS or ANS or ANS                 ALS-XY-WingANS and ANS = NS                  Two-Sector Disjoint Subsets (Sue De Coq)ANS and loop size 4 = NS          SK-loop using cellsAHS and AHS = HS                  Fireworks tripleAHS and loop size 4 = HS          Fireworks quadruple (with overlap cells) or SK-loop (without overlap cells)ANS and AHS = HS+NS               Almost Locked Candidates/Pair/TripleANS or AHS                        ?AHS or AHS                        ?`

You can make some combinations with ANS and AHS sets, but extra calculation is needed for overlapping cells (ANS+ANS still work the same without overlap).
When Rank is 0 then you can apply the rank 0 eliminations. AHS cells cleaning, ANS constraint cleaning, >1 links with common peer exclusion.
When Rank is not 0 then you can apply the combinations between both sets. Main links become truths, >1 links with common peer exclusion.

So it easy to reason: when both sets become balanced (+1 + 1 with 2 overlap) then you can exclude based on the settype.
When sets are almost balanced (+1 +1 with 1 overlap) then you can exclude on combinations between two sets what they can see. (>1 balance is also possible but complex)
Reasoning with only 2 sets is much easier than following a complex chain/net.

ALS-XZ is the most common one which results in most exclusions.
There is overlap between exclusions, but not fully invertible on a normal sudoku like single ANS and AHS.
So you need to search for all types and all sizes. AHS and AHS exclusions can sometimes only be found using 3x ANS.

Not that complex to implement for 2 sets but it would be nicer to have a full XSUDO algorithm and only needing to add the current naming standards.
creint

Posts: 374
Joined: 20 January 2018