O'Reilly logo

Sudoku Programming with C by Giulio Zambon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 13

image

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 candidates. If you reach a contradiction, you need to revert the Sudoku grid back to what it was before your arbitrary choice and try another candidate—hence the “back” of backtracking.

The Solver program with the analytical strategies illustrated in the previous chapters solved 99.85% of the 30,000 generated puzzles (see Chapters 1416 for more details), but for the remaining 0.15%, backtracking was the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required