CHAPTER 14

image

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, you need to be able to solve thousands of puzzles one after the other. The obvious solution is to store Sudoku strings in a file and let the Solver load them one at a time. You do it by adding the following define to the beginning of sudoku_solver.c  (see Listing 3-2, Listing 3-3, Listing 3-4, and Listing 3-5): #define USE_FILES. Then insert the code shown in Listing 14-1 immediately after checking ...

Get Sudoku Programming with C 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.