

I was wrong when I started with, I didn't know that a Sudoku problem will have cases where there wouldn't be any blank squares with just one possibility. This leaves us with values that aren't entered yet, and which become valid possibilities for the cell.įor me, this program didn't work on the first go. The possibilities in each cell can be computed by checking the row, column and the 3X3 sub-grid and eliminating the ones that are found. This is same as saying that each row and column and the 3X3 sub-grid should contain all the values from one to nine. A rule in Sudoku puzzle game says that the there shouldn't be any repetition of numbers along each row, column and the subdivided 3X3 grids. Throughout this article, by "possibilities" I refer to the set of values that aren't present along the row, column and within the same 3X3 grid which contains the cell that's referred to.

But in most cases, Sudoku puzzle boards would have blank cells with a minimum of two possibilities. We cannot exactly determine the runtime for solving a puzzle by just looking at the number of blank squares it has, because some blank squares have enough information that the number to be placed in it becomes obvious. We may be encouraged to think that more the number of blank squares, longer it would take to finish the problem this might be true for human players, but for puzzle solving algorithms, this need not always be true. Even backtracking algorithm solves this problem in seconds this is because of the simplicity of the problem. This program uses a rule-based algorithm to solve a given puzzle. At this point, I cannot claim this algorithm to be the "fastest" because I haven't compared it with other algorithms which might be better.

This article describes a solution written in c++ for solving a Sudoku puzzle, with the fastest time possible.
