468,484 Members | 1,797 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,484 developers. It's quick & easy.

C++ program for solving any 9x9 sudoku.?

Nowhere in the web have i been able to find a perfect program
in c++. Does any computer buff know it out there?

Oct 23 '06 #1
4 11218
fl*****@i-image.com.tw wrote:
Nowhere in the web have i been able to find a perfect program
in c++. Does any computer buff know it out there?
Nope, but it shouldn't be that difficult to write, why don't you give it
a try.

--
Clark S. Cox III
cl*******@gmail.com
Oct 23 '06 #2
fl*****@i-image.com.tw wrote:
Nowhere in the web have i been able to find a perfect program
in c++. Does any computer buff know it out there?
If you have specific C++ questions ask here.
For SODUKO solving strategies that might be amenable
to coding, google for it...there are at least one or
two sites that I know of.
Oct 23 '06 #3
fl*****@i-image.com.tw wrote:
Nowhere in the web have i been able to find a perfect program
in c++. Does any computer buff know it out there?
I once wrote a program that can solve sudokus. But it's far from
being perfect, so I wouldn't give away the code ;)

Maybe you find something on the www (google for "sudoku solver c++").
There are even sites that can solve sudokus online, but i suppose
they are written in JavaScript, so your computer has to do the work.
http://www.sudokusolver.co.uk

Best regards,
-Martin
Oct 23 '06 #4
Clark S. Cox III wrote:
fl*****@i-image.com.tw wrote:
Nowhere in the web have i been able to find a perfect program
in c++. Does any computer buff know it out there?

Nope, but it shouldn't be that difficult to write, why don't you give
it a try.
That depends. A brute force one is doable, but coding in a more elegant
way is tougher.

I've been working on one in C, and it's now about as smart as I am at
solving puzzles. At least it got stuck on the hardest test one I had at
the same place I did.

Its methods are pretty much like mine, the biggest difference has to do
with checking for multiples within a block, row, or column. I didn't
come with a smooth way of building those up, so I have an init routine
that builds up all the possible combinations for the nine numbers in
tuples of cardinality 2, 3, or 4. The program uses the resulting table
to do its check.

I have to work up some algorithms based on more elaborate elimination
schemes like X-wing and such. I haven't because I don't understand
those yet :)


Brian

Oct 23 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by sub1ime_uk | last post: by
3 posts views Thread by Bartosz Bien | last post: by
5 posts views Thread by Stewart Gordon | last post: by
11 posts views Thread by ago | last post: by
6 posts views Thread by blux | last post: by
2 posts views Thread by gieforce | last post: by
reply views Thread by theflame83 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.