|
Introduction Solving Puzzles |
Sudoku /
Sudoku Strategy ThreeDescription![]() Example — A Row Co-Operating with BoxesThe Puzzle shown on the right† has 24 Givens. It cannot be solved using only “basic” Strategies One and Zero. In fact, Strategy One will only solve six Cells before we get stuck. (Strategy Zero would get us further, but we’d still get stuck. For the sake of this example, we won’t go in that direction.) At this point, the Knowns include seven 4s, but we can’t see how to find the other two. We have four 2s, but we’re also stuck there. So, since we also have four 8s, we’re working on them. If we look at the middle-left Box, we have an 8 at the bottom of Column one which Eliminates 8 as a Possible in two Cells of the Box (red arrow and Cell backgrounds). We have an 8 in Column three which Eliminates 8 in three more Cells. With the two Known Cells, this leaves only two Cells that could be Solved by 8 (blue and green backgrounds). Strategy Three is going to tell us which of them must contain the 8 by showing us that the other one cannot. Just to the right, the middle Box has five Known Cells. An 8 just below in Column four Eliminates that Number as a Possible in the two Cells above it. This leaves only the two Cells in Row five (yellow background) that could possibly have the Solution 8. We don’t know which one it will turn out to be, but for our present purpose, that doesn’t matter. There must be an 8 somewhere in the middle Box (the Rules of Sudoku). We’ve discovered that it’s in Row five. If there’s an 8 in Row five in the middle Box, there can’t be an 8 in Row five outside the middle Box (again, the Rules of Sudoku). This Eliminates 8 as a Possible in the middle Cell of the middle-left Box (blue arrow and Cell background). Only one Cell remains (green), so we can Enter 8 here as the Solution. Note that 8 is also Eliminated from two Cells of the right-middle Box (pale blue), but this is not useful to us at this time. Maybe you can remember it for later. Or, maybe you have a way to annotate information like this onto the Puzzle. This example has been contrived not to rely on annotation. † The puzzle used as an example appeared in the Boston Magazine on Sunday, January 22nd, 2023. Boston Magazine puzzles tend to be of medium-to-hard difficulty. ![]() Example — A Box and Column Help Out a RowIf we cast our eyes about for another opportunity, maybe we’ll notice that there are only two Cells that have 8 as a Possible in Row six. There are only three Known Cells, which might put us off the scent, but four of the remaining six unKnown Cells are in Columns that already contain an 8 (vertical red arrows and Cell backgrounds). Strategy Three is going to show us that one of the remaining two Cells cannot have 8 as its Solution so that we can triumphantly write it into the one that remains. The top-right Box, with only two Known Cells, doesn’t look to be of much interest until we notice that the 8 in Row 3 and the 8 in Column 9 together Eliminate that Number from the Possibles of five Cells. This leaves only two Cells in which 8 remains a Possible and they are both in Column seven. The Rules of Sudoku tell us that if there’s an 8 in Column seven in the top-right Box, there can’t be an 8 in Column seven outside the top-right Box. Back in Row six, one of the two candidates for a Solution of 8 turns out to be in Column seven (blue) and when it is Eliminated only one Cell remains (green) and we can Enter the 8. The Computer ProgramYou won’t be surprised to learn that the computer program for Strategy Three begins by making its way through all the Overlaps in the Puzzle. There are fifty-four of them, twenty-seven are Overlaps of Rows with Boxes and the other twenty-seven are Overlaps of Columns with Boxes. No attempt is made to figure out which Overlaps are likely to be worth looking at, we just slog though them all. I’m not even going to bother telling you the order in which we visit them. It doesn’t matter, but note that when the Strategy succeeds in Eliminating Possibles it will affect the data relevant to other Overlaps. We may or may not pick that up, depending on whether or not we’ve already looked at it on this pass. OK, so, we’re looking at an Overlap of a Box and a non-Box (Row or Column). It contains three Cells. Each Cell may be Known (Given or Solved) or it may be unKnown. In the latter case, its Possibles are the Numbers that may yet turn out to be the Solution of the Cell. We gather them all up into the Overlap Possibles so we know which Numbers could be the Solution to any of the unKnown Cells in the Overlap. Next, we do the same thing for the Possibles of Cells that are in the Box but outside the Overlap. That is, we “gather them all up” or, to be more precise and treating the Possibles of a Cell as a mathematical set, we find the union. Finally, we do the same thing for the Possibles of the Cells in the non-Box outside the Overlap. We now know the Overlap Possibles and the Outside Possibles of both the Box and the non-Box. We complement (invert, flip) the Outside Possibles of the Box. This gives us the Numbers that can’t be a Solution to any of the Cells in the Box outside the Overlap. Any and all Numbers that are both here and in the Overlap Possibles (the set intersection) must be Solutions to Cells in the Overlap. They can be in the Overlap, they can’t be in the Box outside the Overlap, they have to be somewhere in the Box so they must be in the Overlap. It they are in the Overlap, they can’t be in the non-Box outside the Overlap so we Eliminate them from all Cells there. Finally, we do this all again, interchanging the roles of the Box and the non-Box. Once again, there isn’t a lot of correspondence between this algorithm and how a person might go about using Strategy Three. It’s all brute-force and plough-ahead-regardless. It’s worth recalling at this point that the best we can hope for is the Elimination of one or more Possibles in one or more Cells. The Strategy does not directly Solve Cells. The computer program does nothing about this and needs to be instructed by the user to run a pass of either Strategy One or Strategy Zero to see if the updated Possibles lead to any progress.
|