18.2. Two Approaches to Sudoku
Sudoku, the current puzzle fad, started in the United States in 1979 in Games magazine, then caught on in Japan in 1986 and became an international fad in 2005. Most newspapers today carry a daily Sudoku. You start with a nine-by-nine grid that is further divided into nine three-by-three regions. Some of the cells will hold a digit from 1 to 9 in them at the start of the puzzle. Your goal is to fill in all the cells with more digits, such that each row, column, and region contains one and only one instance of each digit.
There are two general approaches to the puzzle. One is to assume that you have a grid with all possible digits in each cell, and then remove the digits that we know cannot be there. The second approach ...
Get Joe Celko's Thinking in Sets: Auxiliary, Temporal, and Virtual Tables in SQL now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.