Jump to content

Sudoku Solver...


nfwu
 Share

Recommended Posts

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
Link to comment
Share on other sites

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:

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

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

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

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/

#)

Link to comment
Share on other sites

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?)

#)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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?

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

@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?

#)

Link to comment
Share on other sites

  • 4 weeks later...

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.

#)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 3 weeks later...

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.

Link to comment
Share on other sites

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.

#)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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?

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...