The attached script is a simple brute-force / backtracking solver for Sudoku puzzles.

It will always find a solution (if there is one), but depending on the grid it may take a very long time.

As it is brute force it does not use a recognisable human technique to solve the grid, so is not useful for learning how to solve puzzles.

A blank starting grid will generate a random completed puzzle - useful if you are interested in creating your own puzzles.

The solving algorithm is based on Emanuele Feronato's PHP code found here with only minor modifications to make it work in KiXtart.

Optimising for KiXtart is a lesson left to the reader...

[edit]
I've just re-read Emanuele's page and he states that the algorithm *is* emulating a human method of solving the grid. It looks more like an optimised brute force solve to me, but then I'm not a people person ;\)
[/edit]


Attachments
solve_sudoku.kix (312 downloads)
Description:




Edited by Richard H. (2009-01-02 04:03 PM)