|
View previous topic :: View next topic |
Author |
Message |
| lkSudoku
| Joined: 16 May 2009 | Posts: 60 | : | | Items |
|
Posted: Fri Nov 27, 2009 5:20 pm Post subject: |
|
|
Of course the algorithm I suggested is not optimized nor quick, I only tried to answer the question in the beginning of the thread and suggest a proof of correctness
What I do in my program is as follows:
In order to check for multiple solutions, I first try to solve while allowing backtracking and using the fastest solving methods; once a solution is found, I continue to solve with backtracking as if the solution was an error until either there is another solution (and the previous solution is not unique) or there is no other solution thus the first solution is unique
When performing backtracking I always try one of the cells with minimal number of candidates (with more than one candidate) to decrease the number of guesses |
|
Back to top |
|
|
| sudoking
| Joined: 20 Oct 2009 | Posts: 40 | : | | Items |
|
Posted: Sat Nov 28, 2009 12:42 pm Post subject: |
|
|
I used that one for a while in my generator. However, I replaced it with a modified version of the bb_sudoku algorithm, which was much faster. |
|
Back to top |
|
|
| Lunatic
| Joined: 11 Mar 2007 | Posts: 166 | : | Location: Ghent - Belgium | Items |
|
Posted: Sat Nov 28, 2009 4:08 pm Post subject: |
|
|
sudoking wrote: |
I used that one for a while in my generator. However, I replaced it with a modified version of the bb_sudoku algorithm, which was much faster. |
I know that Brian has a much better algorithm, but I wanted to provide a C code example with a low threshold, especially for newbies.
Furthermore, I'm not used to write C code, I prefer Visual Basic, but VB has not the same capabilities as C/C++. The C code is in fact a translation from my VB code. Maybe I will, someday, when I'm retired , switch to C/C++, I do have the Visual Studio suite. _________________ Marc
~~~<><~~~<><~~~<><~~~<><~~~ |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
Igloo Theme Version 1.0 :: Created By: Andrew Charron
|