Important alert: (current site time 7/16/2013 2:22:27 AM EDT)
 

winzip icon

Ulli's Sudoku Solver (4x faster again)

Email
Submitted on: 2/25/2008 7:32:30 AM
By: ULLI 
Level: Advanced
User Rating: By 19 Users
Compatibility: VB 6.0
Views: 14545
author picture
(About the author)
 
     This is an object-oriented Sudoku Solver combining the "cross hatching" strategy with a backtrack algorithm. It solves easy puzzles in about 600 µsecs and really hard ones usually in under 150 msecs (when compiled) on my old AMD Athlon XP1800+. The most evil one I could find is in the screen shot.

 

Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
'Windows API/Global Declarations for :Ulli's Sudoku Solver (4x faster again)
'**************************************
a few
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 111 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

2/12/2008 11:56:56 PMOldies

OOH yaaaah.!!!
(If this comment was disrespectful, please report it.)

 
2/13/2008 5:43:51 AMULLI

Exchange the 1st and 2nd "If"-line in AllAgree; this speeds up certain puzzles by more than 10% - the reason being that the puzzle is solved row-wise and therefore a row will statistically more often "disagree" than a column.
(If this comment was disrespectful, please report it.)

 
2/13/2008 6:59:42 AMLight Templer

Its a great solution and surely it was good fun (and hard work) for the author. But what is the fun for the user of this app? ;-) Forgive me, Ulli, here are my five ***** and regards - LiTe
(If this comment was disrespectful, please report it.)

 
2/13/2008 10:13:52 AMULLI

Click on Hide
LiTe... ;-)

And tnx 4 the 5.
(If this comment was disrespectful, please report it.)

 
2/13/2008 1:14:51 PMShark

Ulli,

Enhancement suggestions: Add the ability to load (and save) puzzles. Also, add a (Hints off/Hints on) button (see below).

LiTe,

By clicking on Hide and then Solve, you can use the "Solution" side of the form to work on the puzzle. You would would have to comment out the tool-tips in the source code or have a (Hints off/Hints on) toggle similar to Hide.
(If this comment was disrespectful, please report it.)

 
2/14/2008 10:30:46 AMULLI

I have received a puzzle (from Shark, tnx) which requires almost 100 million steps to solve. So please alter the timeout-limit accordingly:

If Success > 99999999 Then '100 million successes and still no solution is a bit much
(If this comment was disrespectful, please report it.)

 
2/16/2008 12:20:41 PMULLI

Sorry for an omission: add the following line somewhere during Form_Load:

Monop = -1
(If this comment was disrespectful, please report it.)

 
2/17/2008 6:24:01 AMpietro ing. cecchi

Very good UPD today february 16th, ULLI!...:)

Pietro
(If this comment was disrespectful, please report it.)

 
2/22/2008 5:22:00 AMpietro ing. cecchi

Wow Ulli!...
Derio's hint, improved in version 2, is really the right strategy: the one used by human sudoku solvers...
I verified the Beast450 sudoku passing from 98,719,671 steps to 9,948 (and from 40 minutes to 3 seconds on my machine). About 10,000 times faster...:)

Good version 2, Ulli!

Waiting for more improvements on the interface...


(If this comment was disrespectful, please report it.)

 
2/22/2008 7:08:28 AMULLI

...sorry Derio that I referred to your idea as "his idea" in the text above, should of course be "her idea". As an excuse may I say that in long-nose-contry first names ending with "o" are usually male. *grin*
(If this comment was disrespectful, please report it.)

 
2/22/2008 9:33:43 AMULLI

...and that was in the IDE, wasn't, Pietro?
(If this comment was disrespectful, please report it.)

 
2/23/2008 8:21:24 AMpietro ing. cecchi

Ulli,
I received your mail, but I'm not able to answer at that yahoo email address (Mail Delivery System says:SMTP protocol diagnostic: 554 delivery error: dd This user doesn't have a yahoo.com account), can you send me an alternate email, please?...:)

(If this comment was disrespectful, please report it.)

 
2/23/2008 4:42:46 PMxpert

Now it doesn't work anymore in Windows 98 because of the use of the Vox object (sapi.dll is not present in the system)

(If this comment was disrespectful, please report it.)

 
2/24/2008 2:03:29 PMErnest

..another superb coding job.

5 ***** 4 u
(If this comment was disrespectful, please report it.)

 
2/25/2008 7:48:20 AMULLI

@xpert

should be easy to delete that...
(If this comment was disrespectful, please report it.)

 
2/26/2008 1:28:58 AMjasonh

This software is too slow trying to work out puzzles. You need to go back and rethink how to make this faster, plus the colours arent the best either. Unless you're still living in the 70's.
(If this comment was disrespectful, please report it.)

 
2/26/2008 11:09:04 PMenmity

@jasonh

it is very fast here, only a few u seconds, you say it is too slow, maybe you used the animation, which is designed to be "slow" enough for human eyes to see, otherwise, you maybe using 8086.

(If this comment was disrespectful, please report it.)

 
2/27/2008 5:16:18 AMULLI

Sure, Jason... What would be the best colors? - I'll do my utmost to meet your personal taste. Anything else you want me to do? Change my name perhaps? Commit suicide?
(If this comment was disrespectful, please report it.)

 
2/27/2008 12:44:52 PMShark

jasonh,

If you think this software is too slow, I would challenge you to write a faster version. It's easy to criticize, but harder to support your criticism.
(If this comment was disrespectful, please report it.)

 
2/27/2008 12:49:17 PMShark

Ulli,

Would it be possible to determine if a unique solution exists? I am a purist at heart and try and solve puzzles without guessing.
(If this comment was disrespectful, please report it.)

 
2/27/2008 2:34:01 PMRussell Sanders

Good work.
(If this comment was disrespectful, please report it.)

 
2/28/2008 6:13:17 AMRuturaaj

It will be of a great use if you can add "Create Puzzle" feature to this project. Solver is always gr8 with "Create Feature". This will give it an educational value and importance. Looking forward to future updates ...
(If this comment was disrespectful, please report it.)

 
2/29/2008 10:10:26 AMRuturaaj

Hi! Just received your email. Tried to reply to that email; but failed. So came back to this comment area!

I understand your current project is
SOLVER; I just suggested that you may think of implementing CREATOR in the same. Doesn't matter if you're planning to implement it as a separate module. Once again, thanks for sharing your quality code.

Best Regards,

Ruturaaj.
(If this comment was disrespectful, please report it.)

 
7/27/2009 6:32:09 AMMalcolm Belgrave

i give u ***** stars but need to generate new games
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.