Monday, June 1, 2020

Sudoku Making

I recently wrote three posts about how to start with a blank 9x9 Sudoku grid and completely fill it with numbers and no guesswork. I showed three basic methods. I thought of more since then that I won’t present. 

A Sudoku puzzle may be described as made of three 3x9 "bands" and three 9x3 "stacks," as demarcated by the lines in the grid below. More puzzles can be made from any full 9x9 grid by: 

- swapping two rows in a band
- swapping two columns in a stack
- reordering bands or stacks
- rotating the entire grid 90, 180, or 270 degrees 
- flipping the entire grid top to bottom or right to left
- transposing around the SW-NE diagonal or NW-SE diagonal. 

All of my methods produce a grid with recurring trios. Such recurring trios do not appear in solutions to puzzles I’ve seen made by others. That is, puzzles with blank spaces masking the full solution and available in newspapers or books, on the Internet, etc. Such recurring trios would also seem to make the puzzle easier to solve.

The following is the first puzzle I showed on May 17. There are recurring trios in the rows of every band, e.g. 3 6 9, and columns of every stack, e.g. 2 3 4.

1 4 7 2 5 8 3 6 9
2 5 8 3 6 9 4 7 1
3 6 9 4 7 1 5 8 2
4 7 1 5 8 2 6 9 3
5 8 2 6 9 3 7 1 4
6 9 3 7 1 4 8 2 5
7 1 4 8 2 5 9 3 6
8 2 5 9 3 6 1 4 7
9 3 6 1 4 7 2 5 8

The following is the second puzzle I showed on May 17, the one above after shuffling digits. It appears more random because 1 2 3 has been replaced by 6 4 7, and 3 4 5 by 7 2 8, and so forth. Yet there are still recurring trios in the rows of every band and columns of every stack. The digits are different, but the locations are the same. 

6 2 9 4 8 1 7 3 5
4 8 1 7 3 5 2 9 6
7 3 5 2 9 6 8 1 4
2 9 6 8 1 4 3 5 7
8 1 4 3 5 7 9 6 2
3 5 7 9 6 2 1 4 8
9 6 2 1 4 8 5 7 3
1 4 8 5 7 3 6 2 9
5 7 3 6 2 9 4 8 1

I have since found ways to eliminate the recurring trios by rearranging a few numbers in the grid. The logic for doing so is rather complicated, but not trial & error. After such rearranging, the scrambler I described on May 17, or the transformations described above, could be used with the grid to create more puzzles with no recurring trios.

Part of the logic is shown as follows. Suppose the top band looks like the following. (It is the first stack above transposed.)

1 2 3 4 5 6 7 8 9
4 5 6 7 8 9 1 2 3
7 8 9 1 2 3 4 5 6

Every row in the left box is repeated in the other two. Swap the numbers 3, 6, 9 in rows 1 & 2. The result would be as follows, with the changes made in green. The recurring trios are eliminated without violating any Sudoku rules. 

1 2 6 4 5 9 7 8 3
4 5 3 7 8 6 1 2 9
7 8 9 1 2 3 4 5 6


I suspect professional Sudoku puzzle makers use a different method involving trial & error. Example 1. Example 2. Whatever methods they do use are likely embodied in a computer program that could do all the trial & error very, very quickly. Do such programs screen for repeating trios? I suspect so.

By the way, every Sudoku solution I have ever seen has repeating pairs in 3x3 boxes aligned horizontally ("band") or vertically ("stack"). The following example is from here

9 2 8 1 6 7 5 4 3
1 7 5 4 9 3 2 8 6
6 4 3 2 5 8 7 1 9
8 9 6 3 2 5 4 7 1
3 1 4 8 7 9 6 2 5
7 5 2 6 4 1 9 3 8
2 3 9 5 8 4 1 6 7
5 6 1 7 3 2 8 9 4
4 8 7 9 1 6 3 5 2

The pairs 1,7 and 2,8 repeat in rows 1-3; the pairs 1,4 and 8,9 in rows 4-6, the pairs 1,6 and 2,3 in rows 7-9. The pairs 9,1 and 2,4 repeat in columns 1-3; the pairs 5, 9 and 2,4 in columns 4-6, the pairs 1,8 and 2,7 in columns 7-9. Such repeating pairs are impossible to avoid.

No comments:

Post a Comment