This thread is to post any questions you have about the 6th contest :)
Printable View
This thread is to post any questions you have about the 6th contest :)
Where can we find any patterns to test our progies against?
Know of any good ones??
:wave:
Your program? ;)
Or www.websudoku.com :)
Have you tried their evil level?
Too bad I don'thave VBnet at home.
Still, did you try my submission?
:wave:
-Lou
I've tried it, my attempt at creating a solver is limited to solving some of the hard ones, so I would have to work on it more :)
By submission you mean the creator/solver in the Games section?
No.
By submission, I meant the pattern I posted, ie...:
http://www.vbforums.com/attachment.p...id=38856&stc=1
Good for a speed test for all!
:wave:
I'll give it a shot tomorrow :) Thanks for the suggestion :thumb:
Do you want us to place the timer code within our own code, or will you do that yourself?
I suppose place that in our own code.Quote:
Originally Posted by manavo11
Oh dear, this seems to be vague doesn't it.
We should only have to submit a class nothing more. A class that implements an interface that is given to everyone.
Then all the judges would have to do to test each entry is to add all the classes to one large project and then call each one in turn, that would be 100% fair then.
The interface should have 2 methods:
VB Code:
Sub Solve(filePath as string) Sub DisplayResults()
And thats it. All the timing code would be put into the Judge's program and not the contestants code.
That's a good idea. Give us interfaces for each language (I don't know whether C# can implement VB.NET interfaces or vice versa) and we submit the class. However I think the timing code should maybe be placed in the class as otherwise you time calling the method as well. What do you think?
You can't ask for everything; I rather code this simple thing 100% myself ;) Especially because that way I can have the data in the format I want and I don't need to use CPU time to convert to some certain format.
What we time when we use an interface:
- raw data to the format programmer wants to
- preprocessing of the data (optimizations etc.)
- the actual algorithm
- after processing: converting to the required format by the interface
The very very bad thing about this is that it costs a lot of time to do the format changes; the algorithm can be superfast, yet the conversions might take time.
Without an interface, we just would time the actual algorithm. A file loader could do the loading of data and preprocessing (ie. prepare used arrays and variables) directly to the format programmer wants. These almost always take the same amount of time no matter what kind of puzzle we have, so there is no point benchmarking these and letting them effect the results.
I hated it in Prime Numbers contest that displaying of data was included in the benchmark... I never saw any point optimizing listbox item adding.
Format conversions? Its loading a file and extracting a few numbers. What hard about that?
Load()
'StartTimer
Solve()
'StopTimer
Display()
Would be nice if you could include it... I know that it's VB6 but I remember you had a VB.Net version, I'll look for it. I don't have a C# one though, just thought of that :(Quote:
Originally Posted by mendhak
Since I can't make for all of them, just make it like the prime numbers contest, a project...Quote:
Originally Posted by wossname
I want in ! :D
How do I enter the contest ?
Or do I just post the code and that's it ?
You know what's funny?? My brother wrote one a few months ago. It works too!
I finished my Sudoku solver, and it works PERFECTLY, it solved ALL the puzles I gave it too...Quote:
Originally Posted by Something Else
698217543
412358679
357649218
749865321
263174895
581932467
934521786
876493152
125786934
Time taken: 134.911 seconds (On a P4, 1400 MHz)
Where did you get that puzle by the way ?
I tested my solver with puzles from here: http://www.websudoku.com/?select=1&level=4 at Evil level, and I never had one greater than 1 second to solve...
When i pluged in your puzle I thought there is something wrong with my solver :D
HAHA :D :D :D :D The funiest thing !!!
I forgot to load a puzzle, the puzzle was empty, and I clicked on "Solve" button, it solved to this:
123456789
456789123
789123456
214365897
365897214
897214365
531642978
642978531
978531642
Time Taken: 1.62140719001996E-02 (0.0162 Seconds)
I made it.Quote:
Originally Posted by CVMichael
:wave:
-Lou
I cant even solve this puzzles on paper, nevermind programming a computer to do it, so i think i wont enter.
That's one thing I love about programming... you program what you want it to do, and it does it for you...Quote:
Originally Posted by x-ice
If the computer took 135 seconds, then probably it will take DAYS for a person to do...
Even the simplest one takes quite a long time.
I did not solve any puzzle on paper. On paper it's even more difficult...
I did solve a few puzzels on http://www.websudoku.com at easy level, but for every number i put in i clicked on "How am I doing?" button... without that button it would take a loooonnnggg time to do it...
Did anyone else finish the Sudoku solver ?
Kuz I finished, and it's working, but I'm wondering why no one posted in the submissions forum ?
Did anyone decide how the interface will be ?
I agree with wossname that we should submit a class...
These are the methods I suggest to be public in the class:
What do you think ?Code:Function SolveSudoku(Puzzle As String) As Boolean
the puzzle should be a string like:
...8.....
..9....68
.8.6.75.3
....2...4
6.4...8.1
5...3....
8.52.3.9.
46....2..
.....1...
And returns True if it was able to solve it
Function ToString() As String
That returns the solved puzzle as string like:
356814972
749352168
182697543
938126754
624975831
571438629
815263497
463789215
297541386
This way it is easy to plug the class in the tester application (for whoever does the testing)
Are you guys taking care of the difficult sudoku problems as well? I'm sure you're aware that the higher levels involve some guessing and backtracking, how are you taking care of that? (Also, are you taking care of that?)
For anyone who doesn't know it yet, you can find some sample tests HERE
and their corresponding solutions HERE
BTW,
CVMichael has posted his times in THIS THREAD
{Good Job, BTW!}
:wave:
My program does not do ANY guessing at all...Quote:
Originally Posted by mendhak
And that does not make any sence to me.... your saying I should pick the numbers randomly, and see if they are valid ? that takes an eternety to finish solving (IF it solves at all)
My program is a recursive function (and some small functions), together is 158 lines (only the solver part, no loading and saving...)
http://www.vbforums.com/showthread.p...27#post2102227
test your apps, thanks to NotLkh, our local maths expert.
Pino
That's interesting how you got it solved then, because I believe that the toughest sudoku puzzles cannot be solved simply by logic, but involve guessing and backtracking...Quote:
Originally Posted by CVMichael
Or maybe you should hope that I've got my facts wrong.
What he does IS guessing. He described in the other topic that he tries a number and then sees if it is valid.
Guessing is also known as brute force.
I guess his definition of guessing is different. :p
Guys, please try this sudoku puzzle as well:
Code:..9..5...
47...2...
.836.4.1.
.15....8.
...3.7...
.2....74.
.4.5.187.
...7...52
...2..1..
I guess so... :)Quote:
Originally Posted by mendhak
But the numbers I try are not random, I make a list of available numbers (that are not used horizontally and vertically, then I try those numbers...
269175438Quote:
Originally Posted by mendhak
471832965
583694217
715426389
894317526
326958741
942561873
138749652
657283194
Solved in 0.0339 seconds... (In the IDE), in 675 iterations...
I'm a bit confused about what the judges expect me to submit. Is it just the solver class/module or is it a full application that loops through sudokus, solves them, times it and displays the result and time used? Should I write the solution back to the original sudoku files or just display it on the screen? Should I write the timing results to a log file or to a listbox on the form?
I'm confused :confused:
Please clarify.
At this moment, you just make a program with a function that solves the sudoku. You can load a file before that (so it can be counted out of the timing). Everything else is voluntary; I've done benchmarking and all kinds of other things to my program. A few guys are trying to push the class idea, but I think it is more confusing.
I'm impressed.Quote:
Originally Posted by CVMichael
Create a project (not just a class) that solves sudokus. In there it would be nice for us if you included the timing code as well, if you want. And it's probalby for the best for you to have a loading sub to read files like we show in the description thread of the contest.Quote:
Originally Posted by kaffenils
Hmm, I've already got one on planetsourcecode. No stealing lol. Actually the brute force method I added was converted from someone elses C code, but the rules based solver is my own work.
for this grid mentioned above:
..9..5...
47...2...
.836.4.1.
.15....8.
...3.7...
.2....74.
.4.5.187.
...7...52
...2..1..
rules solver does it in about 700ms (I've not done an average of a few runs).
brute forced in 7 ms (athlon fx55 though...)
The rules based solver is definately NOT optimised for speed. I'd have to start from scratch to optimise it.
Rules based solving tries to solve more like a human. You start will all squares being able to be any number 1-9, then eliminate possibilities based on rules, such as "if a number is known for sure in a square, then eliminate it as a possibility from all squares in its row, column and block...". You then churn through the rules repeatedly until it is (hopefully) solved.
Brute force will make guesses and check if the grid is valid, if it is invalid then it will go back to a saved state and guess again. There is a sudoku programmers forum with lots of discussion on rules based solving.
timing code:
Code:Dim starttime, endtime As Date
Dim elapsedtime As TimeSpan
starttime = Now
----Call solving sub----
endtime = Now
elapsedtime = endtime.Subtract(starttime)
Dim millisecs As Long = elapsedtime.Milliseconds
Actually, for me it's the other way around, the rules solver is the fastest, under a millisecond, and the brute force one takes the longest up to 6-7 seconds...