Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Sudoku Solver...


  • Please log in to reply
21 replies to this topic

#1 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 11 April 2006 - 11:50 AM

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.
[/list]#)

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, 06 June 2006 - 06:33 AM.








#2 Sunblood

Sunblood

    Wayfarer

  • Active Members
  • Pip
  • 71 posts

Posted 11 April 2006 - 04:00 PM

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.
Posted Image

#3 MSLx Fanboy

MSLx Fanboy

    Local $Clue = 0

  • Active Members
  • PipPipPipPipPipPip
  • 1,046 posts

Posted 11 April 2006 - 05:32 PM

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

#4 JSThePatriot

JSThePatriot

    carpe diem. vita brevis.

  • MVPs
  • 3,692 posts

Posted 11 April 2006 - 07:27 PM

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)


#5 jftuga

jftuga

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 335 posts

Posted 12 April 2006 - 12:52 AM

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

#6 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 12 April 2006 - 08:15 AM

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/

#)

#7 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 12 April 2006 - 08:33 AM

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

#8 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 12 April 2006 - 11:38 AM

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, 12 April 2006 - 11:41 AM.


#9 MSLx Fanboy

MSLx Fanboy

    Local $Clue = 0

  • Active Members
  • PipPipPipPipPipPip
  • 1,046 posts

Posted 17 April 2006 - 02:12 PM

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

#10 Sunblood

Sunblood

    Wayfarer

  • Active Members
  • Pip
  • 71 posts

Posted 19 April 2006 - 01:46 AM

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.
Posted Image

#11 zerobazar

zerobazar

    Seeker

  • Active Members
  • 26 posts

Posted 19 April 2006 - 06:07 AM

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!

#12 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 19 April 2006 - 11:53 AM

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

#)

#13 MrBadAxe

MrBadAxe

    Seeker

  • New Members
  • 8 posts

Posted 12 May 2006 - 03:01 AM

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

One thing this still needs...reset button.

#14 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 14 May 2006 - 06:28 AM

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.

#)

#15 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 16 May 2006 - 11:04 AM

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, 16 May 2006 - 11:05 AM.


#16 gamerman2360

gamerman2360

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 505 posts

Posted 05 June 2006 - 05:02 AM

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.

#17 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 05 June 2006 - 07:35 AM

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

#)

#18 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 06 June 2006 - 01:06 AM

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.

#)

#19 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 06 June 2006 - 01:59 AM

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, 06 June 2006 - 02:28 AM.


#20 jefhal

jefhal

    Not The Appeaser

  • Active Members
  • PipPipPipPipPipPip
  • 708 posts

Posted 06 June 2006 - 02:16 AM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users