CHAPTER 1

image

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. This chapter introduces you to the Solver and the Generator programs and describes the notation I use throughout the book for Sudoku puzzles and how I represent Sudoku grids in C.

Solving a Puzzle

Each blank cell in a Sudoku puzzle offers nine possible candidates. You solve a Sudoku by applying a series of strategies that let you remove candidates from the puzzle’s cells. The solution is complete when only one candidate remains in each cell.

Some strategies are simple. Perhaps the simplest one of ...

Get Sudoku Programming with C now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.