Sudoku is a logic-based, combinatorial, number-placement puzzle. The objective is to fill a 9*9 grid with digits so that each column, each row and each of the nine 3*3 sub-grids contain all of the digits from 1 to 9.

Sudoku solvers employ backtracking to fill in the grid. Backtracking works by trying all the possible combinations of digits in the empty squares. If at any stage we have successfully filled all the empty cells the algorithm has found a solution and it stops. Here’s a visual aid.

My C++ code can be found here. Continue reading

Advertisements