![Loading...](https://link.springer.com/static/c4a417b97a76cc2980e3c25e2271af3129e08bbe/images/pdf-preview/spacer.gif)
-
Book
-
Chapter
Abbreviations and Acronyms
ANSI
-
Chapter
Implementing “Backtrack”
As I have already explained in Chapter 2, backtracking is a nice way of saying “guessing.” When you exhaust all strategies you know, you can only pick a cell that you haven’t yet solved and try out one of its ...
-
Chapter
Modeling a Sudoku Puzzle in C
The purpose of this book is to teach you how to write computer programs to solve and generate Sudoku puzzles.
-
Chapter
Special Sudokus
Now that you know how to generate standard Sudoku puzzles, it is time to learn how to make some special ones.
-
Chapter
Implementing “Naked” Strategies
The three naked strategies, naked pair, naked triple, and naked quad, work on the same general principle: unit by unit, first make a list of all the cells containing naked multiples (i.e., pairs, triples, or q...
-
Chapter
Development Environment
I developed the Solver and the Generator on a Macintosh, but from the very start I wanted to be certain that they were portable to Windows-based PCs. That is why I chose Eclipse as an Integrated Development En...
-
Chapter
Implementing “Box-Line”
As with most strategies, you implement “box-line” with two functions: one general that conforms to the type f_ptr_t as defined in def.h and one to handle an individual unit. The general function, box_line() (see ...
-
Chapter
Implementing “Lines” Strategies
As I already said in Chapter 2, the lines strategies rely on parallel rows and columns. You can implement all lines strategies with three small functions named lines_2(), lines_3(), and lines_4() (see the respect...
-
Chapter
Implementing “Y-wing”
The Y-wing strategy is quite complex, which is reflected in the complexity of its implementation.
-
Chapter
Implementing “Rectangle”
The rectangle strategy is the first level 3 strategy that is not an extension of easier ones. As I explained in Chapter 2, this strategy relies on sets of cells that form rectangular patterns. You implement it...
-
Chapter
Solving Thousands of Puzzles
The Solver program accepts a Sudoku string as an argument. This is OK when you want to solve a few Sudokus, but it is completely inadequate when you want to obtain statistical data on solving puzzles. For that...
-
Chapter
The Strategies
Not all strategies are created equal. When solving a Sudoku puzzle manually it makes sense to use simpler strategies as long as they result in candidate removals and cell solutions, and only then move to more ...
-
Chapter
Puzzle Statistics and More Puzzles
According to Wikipedia, the total number of possible solved Sudokus is a staggering 6,670,903,752,021,072,936,960 ( http://en.wikipedia.org/wiki/Sudoku
-
Chapter
Implementing “Unique”
The “unique” strategy looks for candidates that are unique within a unit. This happens when all other candidates for the same number are removed from the unit (see Figure 4-1).
-
Chapter
Implementing “Hidden” Strategies
The two “hidden” strategies, hidden pair and hidden triple, have the same general design: first, they build lists of the cells containing each candidate number; then, they analyze the lists to see whether pair...
-
Chapter
Implementing “Pointing Line”
As I explained in Chapter 2, pointing-line is similar to box-line in that they both look at the intersection of a line with a box. Therefore, it is not surprising that the implementations of the two strategies...
-
Chapter
Implementing “XY-chain”
This strategy is an extension of Y-wing. Therefore, it is not surprising that the two strategies share a significant amount of code.
-
Chapter
Generating Sudokus
To generate a valid Sudoku puzzle you have to go through the following two steps: generate a completed Sudoku and remove numbers from it in such a way that only one solution is possible with the clues that are...
-
Chapter
The Solver Program
The main program, sudoku_solver.c, accepts the Sudoku to be solved, performs some checks, solves the Sudoku, and presents the final result. It is the module that binds together all the various functions of the pr...