|
-
Jul 25th, 2005, 04:59 PM
#1
Contest 6 - Sudoku solver - Updated 14/8/05
Contest 6 - Sudoku solver
Please discuss this contest in the other thread here
Language
VB 6, VB.NET, C#
Final Entry Date
26th August 2005
What is it?
http://en.wikipedia.org/wiki/Sudoku
The purpose of this contest is to create a solver for sudoku puzzles.
Marking
The main goal is to solve all (or most) sudokus provided during the marking of the competition. The main thing we'll check is to see that it actually works, and that the solutions to the sudokus are correct.
The winner will be determined by the number of sudokus solved, then by the lowest time taken to complete them. ie: a program that solves one more sudoku than another program will beat it, no matter how fast they both are.
The one that solves the most (in the fastest time) will be the winner.
The class located here will be used to time the entries.
Code Format
Your code for solving a sudoku should be able to be called from a single function that will of course need to do some things like :
- Load a file into the array (Not Timed)
- Proccess the array to solve the sudoku (Timed)
- Show the results (Not Timed, show as you like)
As I'm sure you understand this is so we can easily loop the solving process and get an average time for solving.
Additions (14th August 2005) (Not timed)
- Prompt for input of the directory containing the sudokus
- Read all sudoku files in the specified folder
- Option to output the solved sudoku in a folder in the app path folder with your username. The file output should match the *.sol files that NotLKH had provided in the links in the posts below (Same filename as the *.msk files)
- Time and keep track of the time for each sudoku solved and output in a list at the end. The file format should be:
FileName001.msk: (SOLVED or FAILED) in 0,000000 seconds!
FileName002.msk: (SOLVED or FAILED) in 0,000000 seconds!
FileName003.msk: (SOLVED or FAILED) in 0,000000 seconds!
.
.
.
Total Time: 0,000000 seconds
(the "," character being the decimal point)
If you have trouble implementing any of these features, please post in the discussion thread for the contest so some members that have already made these can help you.
Sorry for the late change...
Data Input
You should create a simple function to read the sudoku from a file with the following format :
1...87.2.
.......3.
.....4859
.963....8
3.78269.4
4....526.
9645.....
.1.......
.2.47...1
An example in VB6 would be :
Code:
Private Sub Load(sFileName As String)
Dim FF As Integer
Dim i As Integer
Dim strLine As String
Dim iLineCount As Integer
ChDir App.Path
FF = FreeFile
Open sFileName For Input As #FF
Do While Not EOF(FF)
Line Input #FF, strLine
For i = 1 To 9
If Mid$(strLine, i, 1) <> "." Then
arGrid(iLineCount, i - 1) = Mid$(strLine, i, 1)
End If
Next
iLineCount = iLineCount + 1
Loop
Close #FF
End Sub
What If My Code Has Problems?
Your entry will be accepted even if it has errors. We will not fix the code you submit. However, it someone would like to fix it and see the application working, it is up to each person.
Where Do I Send My Work?
To submit your work create a new Thread in the Contest Entries Sub-Forum. Please title your Threads "Contest 6, Sudoku Solver - Username", changing Username for your username. Attach a Zip file to the post and include all your source files in it.
Source code only please we cannot accept exe's or any form of compiled code!
Final Note
Please remember that the contests are for fun. Also note that commented code is not required but prefered!
Last edited by manavo11; Aug 13th, 2005 at 08:25 PM.
Has someone helped you? Then you can Rate their helpful post. 
-
Jul 28th, 2005, 01:31 PM
#2
Re: Contest 6 - Sudoku solver
Just a bit more info guys, NotLKH has Kindly sorted us out some patterns. and also the solutions. See attactched files
Posted by notlkh
Here are some patterns in the format requested by the contest.
The lines terminate with vbcrlf.
If a number is not masked, it is the number.
If it IS masked, then it is a decimal point.
They are a smattering of 22 and 23 exposed cells.
They are at the Various levels of "difficulty", ie... 0000, 0001, and 0003.
Click Here To Get Patterns
Click Here To Get Solutions
Notlkh will be releasing more patterns for you guys to get your teeth into, so a big thank-you to him for that.
Happy Coding Guys
-
Aug 2nd, 2005, 05:06 AM
#3
Re: Contest 6 - Sudoku solver
-
Aug 7th, 2005, 11:17 AM
#4
Re: Contest 6 - Sudoku solver
-
Aug 13th, 2005, 06:36 PM
#5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|