# Contest: Write the quickest Sudoku solver and win 500\$

#### Erel

Staff member
The challenge is to write the fastest Sudoku solver.
A prize of 500\$ will be given to the author of the quickest solver (which should also solve correctly...).

This contest is open for both licensed users and users who are using the trial version.
To make it a fair contest, no libraries are allowed.

The due date is October 1st. You should export your project and sent it to me: erel@basic4ppc.com.
The prize will be paid with PayPal.

We will run the tests. Note that you can send your projects multiple times and also before the date. I will post the current best result in the forum (without the code).

The project attached should be used as a skeleton for your application.
You can modify the code as needed but Sub Activity_Resume must be kept exactly as it is:
B4X:
``````   Dim puzzles As List
Dim results As List
Dim t As Long
t = DateTime.Now
For i = 0 To puzzles.Size - 1
Dim ans As String
ans = SolveSudoku(puzzles.Get(i)) 'This is your part...
If ans <> results.Get(i) Then
Log("Expected: " & results.Get(i))
Log("Result: " & ans)
End If
Next
Log(Round((DateTime.Now - t) / puzzles.Size ) & "ms (per puzzle)")``````
Cheating is not allowed!
The project includes two sample files. Data.txt holds the puzzles and answer.txt holds the answers. The example project shows how you can read the puzzle and what is the expected result.
Puzzles have a single solution.
Your application will be tested with a different set of puzzles.
Feel free to post any question.

Tip: Disable the debugger when you measure the performance of your solver.

Boten currently leads the contest with an impressive result of 86ms per puzzle!
Note that these results are not final. The real tests will be done with a different and larger set of puzzles.

#### Attachments

• Sudoku.zip
5.8 KB · Views: 488

#### Erel

Staff member

Replies
2
Views
536
Android Tutorial How to write a sudoku solver
Replies
3
Views
12K
Replies
29
Views
9K