Recent Changes - Search:

Sudoku Puzzles

Introduction

Solving Puzzles


Back to Wiki Home

edit this SideBar

Sudoku Strategy One

Description

In Strategy One, we look for a Number that can be Entered into a Group (Row, Column or Box) because there is only one Cell in the Group that can possibly have that Number as its Solution. Obviously, the Number must be missing from the Group in the first place, as it cannot appear twice. Equally obviously, the Number cannot be placed in a Known Cell, i.e. a Cell that contains a Given or has already been Solved. The trick, then, is to eliminate unKnown Cells in the Group by noting that the Number appears in one (or both) of the other (two) Groups of which the Cell is a member. If this can be done for all but one of the unKnown Cells, then the Number is the Solution to the remaining Cell and can be written in. (If all unKnown Cells can be so eliminated, the puzzle is broken.)

With twenty-seven Groups in the Puzzle and nine Numbers to consider, going through them all in turn does not sound like much fun. You may decide to do this later, when the Cells start to fill up with Solutions, but at the start of the Puzzle you’ll probably scan for promising situations. A Number that appears already in a lot of Known Cells will be eliminated from a lot of unKnown Cells. The small number of Cells remaining have a good chance of being the only Cell in one or more of the Groups that don’t already contain the Number. Also, a Group that contains a lot of Known Cells has fewer available Cells to be eliminated. Different people have different approaches at this stage. Puzzles seem to be designed so that quite a few Cells can be solved in this way at the outset, irrespective of difficulty, perhaps as some kind of encouragement.

Example One - Looking for 2s in Boxes

Consider the puzzle shown on the right†. It has 26 Givens. It is of medium difficulty, not requiring the use of any "advanced" solution strategy. The Number 2 appears in the Givens five times. An obvious place to begin would be to look for the remaining four Cells that contain 2 as a Solution. Concentrating first on Boxes, we see that 2 is missing from the top-left, middle-left, bottom-middle and bottom-right Boxes. For each of these, we examine the Rows and Columns that overlap the Box looking for the presence of a 2 outside the Box, meaning that 2 cannot be the Solution to any of the overlapping Cells inside the Box. (We also recognize that 2 cannot be the Solution to a Known Cell.) For the top-left Box, after finding the Cells that can't have 2 as their Solution, we are left with two that could. We have failed to find the 2 in this Box using Strategy One at this time. Moving on to the middle-left Box, however, we see that the 2 in the fifth Row means that 2 cannot be the Solution to two Cells and the 2 in the sixth Row means that 2 cannot be the Solution to three more (indicated by red arrows and background shading in the diagram). Three Cells contain Givens, leaving only a single Cell in which 2 could be the Solution. Since there must be a 2 in this (and every) Box, we can write it in. Now if we go back to the top-left Box, we find that the 2 we've just added as a Solution in Column three, together with the 2 which is a Given in Column one and the two Givens in the Box, leave only one Cell that could have the Number 2. Again, we can write it in.

Although, at this time, we cannot find the other 2s using this Strategy, we can move on to other Numbers, look for the Boxes from which they are missing and see whether or not we can place them using the overlapping Rows and Columns in which they appear outside the Box. It is sensible, for obvious reasons, to deal with Numbers that are already present in many Cells (such as, in this example, 4, 6 and 8) before moving on the Numbers that are present in fewer Cells (in this example, 1, 7 and 9). After we've found the 6s, we can circle back and find the remaining 2s and keep going in this way until we have Solutions to a total of 15 Cells. This is Sudoku at its easiest and, for casual players, most enjoyable.

Example Two - Looking for 5s in Rows and Columns

We are not, however, quite done with Strategy One on this Puzzle. We’ve been talking about Boxes when we should really have been talking about Groups. In other words, we should also be looking in Rows and Columns to see if they have just one Cell that can contain some Number. At right, we continue with the same Puzzle, which now has forty-one Known Cells but no longer yields to our focus on Boxes. We have found all the 2s and all the 6s. There’s still only one each of 1, 7 and 9 but there are lots of 4s, 5s and 8s. So, we’d be sensible to look for 4, 5 and 8 in Rows and Columns that have the fewest unKnown Cells.

Column one (the left-most) leaps out because it has only two unKnown Cells. But, the missing Numbers are 1 and 9 and we quickly see that neither is in a Row or Box shared by those two Cells. Column six has seven unKnown Cells. The rest have four or five and we’re just going to have to slog through them. Row five (the middle Row) has four unKnown Cells and three of them are in Columns that already contain 5. We can write 5 in as the Solution to the Cell intersecting with Column seven. We mustn’t forget that Knowns in Boxes also eliminate numbers from Rows and Columns. Row seven has five unKnown Cells, but two cannot contain 5 because of the 5 in the bottom-left Box. 5s in Columns seven and eight eliminate two more Cells, leaving only the one in Column nine, where we can Enter 5 as the Solution.

In this Puzzle, at this point, there are no Solutions to be found by looking in Columns, but I think it should be clear how this is done. Working with Rows and Columns may be slightly less enjoyable than looking in Boxes. Very easy Puzzles tend to avoid the need to do this. Now there are seventeen Cells Solved in this Puzzle. With the twenty-six Givens that’s forty-three Known, thirty-eight remaining unKnown. No more progress can be made using Strategy One. We’ll meet this Puzzle again in Strategy Zero.

The Computer Program

TO DO - write this section.

The Original (Obsolete) Computer Program

I made no attempt to make my Sudoku-solving computer program operate in a way similar to how a person might approach the problem. This made writing the program easier, but in retrospect I might have learned more if I’d done otherwise. Oh, well.

Rather than try to guess which Groups and Numbers are most likely to yield Solved Cells, the program just makes its way through them all. It looks at all the Groups, Rows first, then Columns and, finally, Boxes. Left-to-right, top-to-bottom. For each Group, it then looks at each Number, from 1 to 9. If the Number is present in the Group, i.e. is a Given or a Solution in any Cell in the Group, then the program does nothing for that Number and moves on to the next. (The determination of whether a Number is present takes place when the Number is reached. No “snapshot” is taken when work on the Group begins. So, if a Number is Entered in the Group as a side-effect of Solving a Cell with a different Number, nothing breaks.) If the Number is not present in the Group, then an attempt is made to place it. This is done by looking at all the unKnown Cells in the Group and counting how many of them have the Number listed as a possible solution. If this turns out to be just one, the Number is Entered in that Cell.

Now, how does a Number get listed as a possible solution (termed a Candidate) of a Cell? I’m glad you asked. It’s quite simple, but nothing like what any normal person would enjoy doing, which makes it hard to use the program to assess the difficulty of a Puzzle. When the Puzzle is set up, all Cells are unKnown and all Numbers are listed as Candidates of every Cell. When a Cell becomes Known, either because it is a Given or because it is Solved, then the Number Entered is removed (Eliminated) from the Candidates of all unKnown Cells in all three Groups of which the Cell is a member (one Row, one Column and one Box). This happens in a somewhat behind-the-scenes manner, hidden inside the subroutine that at first seems to do nothing more than put the Number in the Cell. It works very well, but, as I’ve mentioned, makes the program unrepresentative of how a person would solve a Puzzle. Candidates are also used in more subtle ways by the other Strategies, so don't skip the description of the computer program if you want to know the rest.

The puzzle used as an example appeared in the Boston Globe newspaper on Thursday, November 10th, 2022. It is rated by the Globe as “more difficult”.


Edit - History - Print - Recent Changes - Search
Page last modified on April 18, 2023, at 03:31 PM