||Previous Page||A First Approach- Brute Force||Next Page|
The most basic way that I can think of is this: let's start with a Sudoku board, and the first blank cell we come across we assign the number 1. We do the same for the next cell, and so on, until we get to the last cell. We then check if the constraints are satisfied, and if so we are happy, and if not we go back and change the last number we assigned to the next value. If we run out of values we obviously made a mistake a bit earlier; we unassign that cells value and move to the cell before it. Going back and changing a value assigned is called Backtracking. This method can be called Brute Force.
(This is also called Depth First Search; but, then again, everything is search)(Inside joke, don't worry about it)
In case that wasn't clear, let's see this in action!
|Previous Page||A First Approach- Brute Force||Next Page|