Sign in to follow this  
Followers 0

Sudoku Solver...

22 posts in this topic

Posted (edited)

4th Revision!

http://www.autoitscript.com/fileman/users/nfwu/sudoku.au3

I had a look around at some of the other Sudoku helpers, and noticed that none of them automatically tracked all the data while you are solving a puzzle.

This one tracks the possibilities that each location can have.

(I apologize to those who have small screens... The GUI width and height is about 700+ pixels)

Click on the small buttons and see what happens!

I don't really know how to explain how to use this, try learning through experimentation!

Screenshot:

Posted Image

The solution to the above displayed sudoku, if you are interested, can be seen by clicking on this link: http://img124.imageshack.us/img124/766/solution5mc.png

list]

[*]Initial: A sudoku solver which automatically keeps track of the data.

[*]Revision 1: Added group boxes to distinguish the different cells

[*]Revision 2: Added automated Sudoku solving (not perfect yet!)

[*]Revision 3: Added an undo feature. Large buttons revert to small buttons when you click on them.

[*]Revision 4: Fixed 2 bugs. Upgrated Automatic Solving.

EDIT: 12th April 2006 - 04:27 PM: 1st Revision

EDIT: 12th April 2006 - 07:32 PM: 2nd Revision

EDIT: 14th May 2006 - 01:17 PM : 3rd Revision

Edited by nfwu

Share this post


Link to post
Share on other sites



Posted

Could you add some dividing lines to your GUI? Right now it just looks like a garbled mess of buttons when it isn't solved.

Other than that, great job.

Share this post


Link to post
Share on other sites

Posted

Very nice. Just, like Sunblood said, put groups around each main box (GuiCtrlCreateGroup I believe), and it will make a lot more sense.

It took me a minute to realize what it was I was looking at :think:

Share this post


Link to post
Share on other sites

Posted

First I would like to say. You have done an excellent job on this.

I am sad to say I had to go look up Sudoku to find out what it is and how it works. I figured I would share my findings here and save everyone else the trouble.

http://en.wikipedia.org/wiki/Sudoku

Excellent program/game. I look forward to playing it and sharpening my logic skills.

Thanks,

JS

Share this post


Link to post
Share on other sites

Posted

Excellent program/game. I look forward to playing it and sharpening my logic skills.

Yea, some of the puzzles can be pretty challenging. USAToday.com has daily puzzles.

-John

Share this post


Link to post
Share on other sites

Posted

Thanks for the feedback!

@JSThePatriot: Thanks for sharing that link... Should have realised that wikipedia had an article for it.

@Sunblood and @MSLx Fanboy: I will put some code in there to put groups round the cells, thanks for informing me of that!

@jftuga: Nice link! But maybe you should be more direct: http://puzzles.usatoday.com/sudoku/

#)

Share this post


Link to post
Share on other sites

Posted

1st Revision.

=========

Added group boxes to distinguish the different cells.

Please give more suggestions for improvement!

(Who wants a sudoku generator to go along with this?)

#)

Share this post


Link to post
Share on other sites

Posted (edited)

Revision 2.

=======

Added automated Sudoku solving (not perfect yet!)

Input the sudoku, then press {F5}, when the auto-solver gets stuck, press {F6} then solve the problem, then hit {F5} to continue the auto-solving.

NOTE: When the auto-solver gets stuck, the part where it gets stuck at is most likely NOT going to be easy to solve!

#)

EDIT:

Some data for the interested:

The auto-solver solves the example sudoku in the 1st post in 3 seconds without getting stuck.

Edited by nfwu

Share this post


Link to post
Share on other sites

Posted

When selecting boxes, a few mini-buttons tend to delete all together. To clarify, if only two options exist for a specific square, when one of the values is selected in a neighboring box, both buttons disappear.

Also, how does the program look with @GUI_DISABLED set for the large buttons?

Share this post


Link to post
Share on other sites

Posted

I think the large buttons should revert back to the smaller buttons if you click them again. I keep making mistakes but I can't undo them without undoing the entire puzzle.

Share this post


Link to post
Share on other sites

Posted

I fully agree with Sunblood, I'm doing the same mistakes!

I would also enlarge the font (and maybe put it bold) on large buttons: it would give better visibility to help solving the puzzle.

This script is a very nice helper. Nice job!

Share this post


Link to post
Share on other sites

Posted

@Sunblood and @zerobazar: Thanks for the input, I'll release that in the next revision.

@MSLx Fanboy: Is it possible for you to post some "before" and "after" screenshots?

#)

Share this post


Link to post
Share on other sites

Posted

Awesome. Was trying to program something like this myself but you've done a superior job.

One thing this still needs...reset button.

Share this post


Link to post
Share on other sites

Posted

Finally got round to doing what I promised 1 month ago.

Revision 3

=======

A undo feature has been added~!

Large buttons revert to small buttons when you click on them.

Please check for errors with the new code, as far as I tested it, it works as it should.

@MrBadAxe: Reset = rerunning the program. Sorry, but i did not see your post when doing this revision.

#)

Share this post


Link to post
Share on other sites

Posted (edited)

Discovered that the undo feature prevents automated solving from working correctly.

Will fix that in the next revision along with a new automated solving algorithum.

This new one should be able to solve the whole puzzle without human intervention.

#)

edit: @MrBadAxe: I'll include a reset button along with this one!

Edited by nfwu

Share this post


Link to post
Share on other sites

Posted

When you undo it. It sets all the small buttons back in all the other boxes in that row/collum. The bad thing is that includes the ones that are already in the large button form. Then you can accidently click a small button behind a large button and make a mess of the game board.

Share this post


Link to post
Share on other sites

Posted

That's wierd.

I'll check it out when I get home 2dae.

#)

Share this post


Link to post
Share on other sites

Posted

Thanks for spotting that bug. My private version has been updated.

Will update the public version in the first post when the automatic solving has been repaired and upgrated.

#)

Share this post


Link to post
Share on other sites

Posted (edited)

Current status: After much fiddling, repaired basic automatic solving.

Now testing advanced automatic solving.

About to finish,

nfwu

#)

Edit @ 09:59 AM:

Spotted a bug with the undo code - involving reselection. Now repairing.

The Automatic Solving works much better now - only jams up on the really hard puzzles (that I myself cannot solve :D ).

Edit @ 10:07 AM:

Bug repaired, looking for more ways to upgrate the Automatic solver...

Edit @10:09 AM:

Spotted yet another bug, fixed it on the spot.

Edit @ 10:27 AM:

Added a new method of telling whether a number can go into a box. The "twin" method. Inexperienced players of sudoku will point this out as a bug, but it is not.

Hopefully I can release it by 11AM!

Edited by nfwu

Share this post


Link to post
Share on other sites

Posted

3rd Revision!

I really like this application. I personally don't like games and would much prefer to work out the solution with a program like yours than to burn brain cells doing it the hard way.

Are you planning a solver for the Rubiks Cube next? If so, I'd pay $3 to $4 for it! How about an automated Taipei player?

Share this post


Link to post
Share on other sites

Posted

I have the logic for automated solving of a rubik cube somewhere.

I made it before I had heard of AutoIt and after I had become better at solving the Rubiks cube.

My father is much better at the rubiks cube than I am. Less than 1 minute if I rember correctly.

#)

Share this post


Link to post
Share on other sites

Posted (edited)

Revision 4!

========

Repaired 2 undo bugs (thanks gamerman2360).

Repaired Automatic Solving

Upgrated Automatic Solving

The "twin" solving method is NOT included with this revision as it is still in the works. (taking longer than expected.)

#)

Edit: Known problems: The "AutoSolve Off" button does not work. Use {F6} instead.

Edited by nfwu

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.