liveBook · Manning

Sudoku puzzle

As explained in Software Design for Python Programmers

A Sudoku puzzle is a constraint puzzle in which digits must be placed in a grid so that each required row, column, and region satisfies distinctness rules.

A Sudoku puzzle places digits in a grid while preserving distinctness in every row, column, and three-by-three block. A solver fills one cell at a time, testing numbers from 1 through 9 and using recursion to advance through the grid. section 15.10

Input and solution

A file containing zeros or dots for empty cells is read into the grid. The program prints the starting puzzle and, when solving succeeds, prints a completed grid; otherwise it reports no solution.

How Software Design for Python Programmers covers it

How deep it goes
Explains grid traversal, validity checks, recursive base cases, and backtracking implementation.
Examples
Uses a file-based grid, a worked input-and-solution pair, and Python solver listings.
What you can do after
Builds a Python program that reads, solves, and prints a Sudoku puzzle or reports no solution.
How it connects
Connects Sudoku puzzles with recursion, backtracking, brute-force search, and the eight queens puzzle.

Also explained in

Compare how 2 books explain Sudoku puzzle →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Design for Python Programmers. The section links point to the parts of the book it draws on.