Help for Locked (AKA Naked) and Hidden Sets

If n cells in the same row or column or box only contain n numbers between them, then in the solved puzzle these numbers will occupy these cells. This program looks for naked pairs, triplets, quads and quins. If any of these numbers occur in other cells in the same row or column or box, then they may be eliminated. If n equals two or three, and they occur in a row or column within a single box, then eliminations can occur for the box as well as the row or column.

The naked pair example (Top95, #6) has the numbers 8 and 9 in cells r8c3 and r9c3. Therefore 8 and 9 can be eliminated from other cells in column 3, as well as in box 7, yielding eliminations of eight 9's and three 8's.

An example of a naked quad is available in Top95, #18. The four cells r5789c8 in column 8 contain the four numbers 1,4,5,6 which can be eliminated from r2c8 and r6c8 (see below). It then finds a naked triple in Box 3 before solving the puzzle. Top95 examples which are solved at the Naked Sets level are #15, #18, #21, #26, #30, #33, #34, #37, #42, #49, #57, #62, #63, #67, #73, #79, and #95

Some nice examples of naked quins are:

 .9..83....2...6457........33..9...6.......8.5.....  hidden pair / naked quin
 ...  hidden triple / naked quin

and a series of them has been published by champagne here, eg


Hidden Sets

An interesting feature of locked sets is that there will be a complementary hidden set. The digits in the hidden set are those remaining after those in the locked set plus any given cells are eliminated. For example, in the first example, there is a hidden quin of 12457 in box 7, and of 24567 in column 3. In the second example there is a hidden pair of 27 in column 8. Generally it is easier to spot locked sets, but this is a personal preference. It makes sense to look for hidden pairs, as these might occurr in a house with nine unsolved cells, or eight with one given. The complementary naked septet or sextet would be harder to spot.

Once the locked (or naked) cell eliminations have been performed, the program repeatedly cycles through naked singles, hidden singles and box-line before trying locked sets again until there are no further eliminations or the puzzle is solved.