sudoku solver program

The algorithm i hav in my mind is :
program will try to place a no. ,say 2 ,in any empty place in the grid.if it finds any violation,ie violation check functions returns true if they find another 2 in either row/column/box ..it moves to next emty place.
to check the violation..there should be three functions ,for checking error in row -column and box .
the numbers to be inserted, are asked by a recursive function where the base case is there are no emty place..but havn'e been able to construct this function :p

you may find readymade solution in net..but writting completely on your own
gives a great satisfaction !!! :)
 
heres my take on your logic

the function places a no and checks for violation. if the no is already present it moves on to the next number rather than the next box

you think this has to be done using arrays???
 
There are many ways, such as backtracking, constraint posting, heuristic search (A* algorithm etc).

Constraint posting seems to be most logical and efficient, practically a brute force or backtracking approach seems easiest to program.
 
This is a console-based Linux program, written in C language, that solves Su Doku puzzles (aka Sudoku, Number Place, etc., see figure 1) using deductive logic. It will only resort to trial-and-error and backtracking approaches upon exhausting its deductive moves.

A Su Doku Solver in C
 
Back
Top