| s0nny_black
| Joined: 28 Mar 2006 | Posts: 14 | : | | Items |
|
Posted: Tue Apr 18, 2006 4:47 pm Post subject: java solving |
|
|
Hi, I have produced a java implementation of a dlx based generator. It produces a sudoku puzzle with a set number of clues, however, the puzzle may or may not be solvable. This is because I have not integrated a solving engine into the generator code that will run after the entry of each new clue to check that clue is valid.
At the moment I just cannot get my head around the solving.
My generator has an array called: dlxGrid[81][9].
where dlxGrid[number of cells in a grid][all possible digits that can go in cell].
I have a random number generator that generates 2 numbers 1 between 0-80 and one between 0-9. this gives me a placement from my array dlxGrid. i then transpose this to my sudokuGrid[81] and zero the corresponding values in dlxGrid[][] (this stops me from selecting any number that would conflict).
As you can hopefully see this allows me to produce a sudoku grid with clues which do not conflict with each other, but could produce an unsolvable puzzle.
i'm guessing my solver would be similar to my generator but with back tracking just incaase it cannot be solved.
Can anyone like Ruud simplify the process of solving like he did for generating here:http://www.setbb.com/sudoku/viewtopic.php?p=1811&mforum=sudoku#1811
as i found this very useful and managed to code it in a day. (i think anyway!) |
|