473,466 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 11425
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: sub1ime_uk | last post by:
Thought I'd offer a method for solving all possible 9x9 sudoku puzzles in one go. It'll takes a bit of time to run however (and 9x9 seems to be about as big as is reasonably possible before...
3
by: Bartosz Bien | last post by:
Hello friends, I'm looking for a simple Sudoku puzzle generator with C++ source code. I browsed some sourceforge projects, but these are mostly in Java and rather too complex. A decent...
5
by: Stewart Gordon | last post by:
I have a few Sudoku puzzles on my site. http://www.stewartsplace.org.uk/mindbenders/ But adding extra columns and rows to separate the 3x3 blocks seems a rather kludgy approach, and the result...
11
by: ago | last post by:
Inspired by some recent readings on LinuxJournal and an ASPN recipe, I decided to revamp my old python hack... The new code is a combination of (2) reduction methods and brute force and it is quite...
2
tpgames
by: tpgames | last post by:
I have not been able to find source code for a kids (2x2) sudoku game, and was wondering if anyone had the time to volunteer to make a JavaScript version for me that uses images. I only ask, because...
2
tpgames
by: tpgames | last post by:
In a 3x3 sudoku JavaScript with images, what is 48? and 57? I'm trying to convert a 3x3 sudoku to a 2x2. I don't understand why 48 can't be say, 46 or 45; why 57 can't be 54, etc. Its the numbers I...
6
by: blux | last post by:
I am working on a function to check the validity of a sudoku puzzle. It must check the 9x9 matrix to make sure it follows the rules and is a valid sudoku puzzle. this is what I have come up with...
1
by: deanchhsw | last post by:
Part A (http://bytes.com/topic/java/insights/645821-sudoku) B (http://bytes.com/topic/java/insights/739704-sudoku-b) C (http://bytes.com/topic/java/insights/739703-sudoku-c) this question refers...
3
by: DannyB13 | last post by:
Hi, and thanks for possible help in advance. Here's my dilemma. I've been making a sudoku generator, and I'm now stuck on one part. I must be able to take a 'solution' and verify that it is correct,...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.