flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > Sudoku solver [DONE] |
Author |
|
ATV 23 Mar 2006, 12:00
World is full of Sudoku people, so here is Mini Sudoku.
I don't like solve by myself, so lets give computer do the hard job. If you want see really small Sudoku solver check Hugi Size Coding Compo 25 http://www.hugi.scene.org/compo ToDo: - sudoku generator - save best times into file edit1: Madis, thanks for info, it's fixed now edit2: Added enable/disable undo, drag/drop data file edit3: Ask to save after changes, few bugs fixed edit4: menu, undo/redo, show used time, arrow keys, bigger number font edit5: is solvable test,copy2clipboard,filename in caption,initial digits read-only edit6: load multi entry sudoku file,restart,output in 81/9x9/9x9grid format
Last edited by ATV on 08 Sep 2006, 11:59; edited 6 times in total |
|||||||||||
23 Mar 2006, 12:00 |
|
Madis731 23 Mar 2006, 12:16
That is my kind of program
The only problem is that your stack is floating away and its crashing when returning from your code to user32.dll You do NOT want to modify EBX in your dialog code - I've made this kind of mistakes a lot. Replace: Code: line 38: push ebx esi edi cmp [msg],WM_INITDIALOG ;Then replace line 220: pop edi esi ebx ret Its always a good idea to preserve registers - I think you have WinXP, that is why it works. PS. http://www.hugi.scene.org/compo <= I see Estonia listed there, also |
|||
23 Mar 2006, 12:16 |
|
ATV 25 Mar 2006, 10:10
locodelassembly, This is my first win program (and few visual basic progs over 10 years ago)
I don't know anything about windows programming, DOS is my thing. My old P166 has some startup problems (hd or motherboard problem), so I start to try win programming with my HP laptop with WinXP/SP2 Home. And Sudoku seems to be easy to start with. |
|||
25 Mar 2006, 10:10 |
|
ATV 27 Apr 2006, 07:09
Above attachment updated
New features in v0.04 - menu - undo/redo rewritten - show used time - use arrow keys - bigger number font |
|||
27 Apr 2006, 07:09 |
|
rugxulo 27 Apr 2006, 18:43
|
|||
27 Apr 2006, 18:43 |
|
ATV 31 Jul 2006, 09:06
Above attachment updated
New features in v0.05 - try automatically detect empty char - is solvable test - copy current numbers to clipboard - filename in caption - initial digits is read-only thanks to Alex Torba |
|||
31 Jul 2006, 09:06 |
|
ATV 08 Sep 2006, 12:01
Above attachment updated
New features in v0.06 - load multi entry sudoku file - cell count/81 - restart - output in 81/9x9/9x9grid format |
|||
08 Sep 2006, 12:01 |
|
rugxulo 24 Oct 2006, 17:12
Here's another similar thread: Smallest sudoku solver
|
|||
24 Oct 2006, 17:12 |
|
0.1 08 Aug 2007, 13:45
Hello ATV!
Cool stuff really! Just a little favor from you plz. Can you post the logic of your SuDoKu solver in plain English here? plz. thx. PS: Well not the whole program Only the solver function! |
|||
08 Aug 2007, 13:45 |
|
ATV 09 Aug 2007, 07:15
0.1, plain English, huh, then Im wrong person to answer, my English is very bad.
It's just brute-force solver using recursive call (it keep previous values/empty position in stack). Code: Find empty position, if not found puzzle is solved then set it '1' and check if other '1' found in same row or column or box if same value not found, find next empty position and so on else try '2' then '3' ... if '9' can't be set, go back to previous empty position (note: it's not empty any more) and set it +1 then check, and so on If you are new with recursive calls try find some Fibonacci, factorial, GCD, sort, dir-search and Towers_Of_Hanoi algorithms, they are often written with recursive calls http://en.wikipedia.org/wiki/Recursion_%28computer_science%29 |
|||
09 Aug 2007, 07:15 |
|
Madis731 09 Aug 2007, 08:00
I think it was nicely explained I didn't even know it before, how actually brute-force works on Sudoku. My mind can only handle 3x3 squares and 1x9, 9x1 lines
|
|||
09 Aug 2007, 08:00 |
|
0.1 09 Aug 2007, 08:09
Thx a lot ATV!
I must confess I'm still pretty confused (DUMB!) But your explanation is very valuable to me! _________________ Code: o__=- ) (\ /\ |
|||
09 Aug 2007, 08:09 |
|
ATV 09 Aug 2007, 11:22
Madis731, brute-force works very well, because it will always find solution. More human like solvers usually gives "running out of algorithms" errors with really difficult sudoku. It's really difficult to write solver without brute-force. And those solvers are very big, no chance in Hugi Size Coding compo. Look from sudoku boards thinks like "X-Wing", "XY-Wing", "Forcing Chain", "Swordfish". Sometimes brute-force is little slow because it don't see easy numbers. Like last row "12345678x" that "x" will be filled in last with try "1" to "9", human just put "9" there without big thinking and looks second easy place.
|
|||
09 Aug 2007, 11:22 |
|
tthsqe 06 Jan 2010, 19:21
Your program is really great, but the solver is realy slow.....
I have got a solver (working on a generator) that is VERY fast.... would you mind putting it in your program? |
|||
06 Jan 2010, 19:21 |
|
ManOfSteel 06 Jan 2010, 22:31
ATV's last post is the one right above yours. And it's 2 years and a half old.
|
|||
06 Jan 2010, 22:31 |
|
tthsqe 07 Jan 2010, 01:37
so this project has been abandoned?
|
|||
07 Jan 2010, 01:37 |
|
ManOfSteel 07 Jan 2010, 13:01
No idea. Probably. Ask ATV if you ever find a way to contact him.
But feel free to continue where he left. |
|||
07 Jan 2010, 13:01 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.