|
View previous topic :: View next topic |
Author |
Message |
| hoppy
| Joined: 15 Jul 2005 | Posts: 7 | : | | Items |
|
Posted: Fri Jul 15, 2005 11:27 pm Post subject: my attempt - vb.net |
|
|
I decided not to google to see other peoples code before having a go at this myself. So, I now have a solver that works. Now I realise that it needs a lot of rules and probably could do with some speeding up (I've got it flashing colours as it solves and stuff which makes it pretty slow, lol).
My rule 1 is a bit daft as well - it does "this square is definately value X, so eliminate X as a possiblilty for other squares in my row, col, and block" which is fine, but it does this on every square, and more than once (i just run through the rules repeatedly until it is solved). I'll redo that and only run it when a squares value becomes definate - and only run it on that square.
Thankfully I've got the rules in seperate classes, which makes it easy to add more.
My first sudoku solver, and my first ppc program...
vb.net - pocket pc
Last edited by hoppy on Fri Jul 22, 2005 10:54 pm; edited 1 time in total |
|
Back to top |
|
|
| hoppy
| Joined: 15 Jul 2005 | Posts: 7 | : | | Items |
|
Posted: Thu Jul 21, 2005 3:25 pm Post subject: |
|
|
Hmm this is harder than I thought.
Added the rule to look for 2 squares that can be the same two numbers - eliminate all other numbers as possibilities for those squares.
It tests groups of 2-5
It catches multiple groups in the same row - e.g. two pairs or two triplets.
It does row,cols, blocks
Next Rule..... |
|
Back to top |
|
|
| dukuso
| Joined: 14 Jul 2005 | Posts: 424 | : | Location: germany | Items |
|
Posted: Thu Jul 21, 2005 4:55 pm Post subject: |
|
|
hi Hoppy,
I also wrote a solver yesterday.
In C.
I keep a 9*9*9 array of forbidden placements and
I'm just testing for forced placements in a row,column,block,cell
(81*4 tests).
And it's already pretty fast, so now I'm wondering whether
it's worth to include some other fishy tests...
Tell me, which further tests you think are easy to implement
and give considerable speed increase
Guenter. |
|
Back to top |
|
|
| hoppy
| Joined: 15 Jul 2005 | Posts: 7 | : | | Items |
|
Posted: Fri Jul 22, 2005 9:52 pm Post subject: |
|
|
I've put it on planetsourcecode - not the ppc version, but a windows version. Can't link it as it's not there yet. "VB.Net Sudoku Solver" is the name.
So, its vb.net and does a,b,c,d,f from these rules:
http://www.sudokusolver.co.uk/solvemethods.htm
d and f are fully implemented.
It is not fast (it will churn for 10-15 secs on my uber-processor), in fact I might stick back in all my flashing light and pretty colours as they amuse me when it is solving, lol...
l then got sick of it when it fails to solve puzzles, and added a brute force option based on the C code here:
http://www.users.waitrose.com/~nihilist/sudoku.html
Which is hideosly speedy (<0.03s for most grids)
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=3829&lngWId=10 |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
Igloo Theme Version 1.0 :: Created By: Andrew Charron
|