473,779 Members | 2,063 Online
Bytes | Software Development & Data Engineering Community
+ 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 11448
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
2645
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 combinatorial explosion completely scuppers this type of program)... Basic idea:- Start with a grid initialised with: 123456789
3
3026
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 descriptive document would be good as well. -- Best regards,
5
9997
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 isn't aesthetically the best either. There ought to be a way of making the grids look nicer. I've played about a bit with rowgroups and colgroups before discovering that rowgroup is called tbody.
11
4144
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 faster than the ASPN program. If anyone is interested I attached the code in http://agolb.blogspot.com/2006/01/sudoku-solver-in-python.html
2
1441
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 comparing the 2x3 and the 3x3 source codes I do have, does not help me figure out how to make a 2x2 sudoku game. I also ask because my 4 yr old nephew is hooked on sudoku and really wants one with images. He's been bugging me for 4 months, and I've...
2
1871
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 don't understand. function KeyDown(whichkey) { if (IsOver) return; if (I_Sel==-1) return; if ((whichkey>=48)&&(whichkey<=57)) { Fld=48-whichkey; window.document.images.src = NPic.src; I_Sel=-1;
6
11883
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 so far: However I have found that it does not check it correctly. I just need to check the 9x9 array, which I am passing to this function against the classic sudoku rules and then return true for
1
1869
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 to the Sudoku howto posted on this website. The links are shown above. My question centers around the boolean variables declared in Part A, such as the following. boolean rows= new boolean; ...
3
5975
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, by checking a few things. 1. There are enough numbers, no 'periods' which signify '0' or 'no input'. 2. That there are no duplicate numbers in any row, column, or 3x3 box. I have been thinking of ways to do this and I've come up with 2 things....
0
9636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10138
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10074
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9930
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6724
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.