Glover Family Net
Home
Signs of Success
The Mini
Prime Numbers
Sudoku Solver
Wiki Studios
Victoria Glover
FFA Climbing
Minimal Blog
SKI Holiday
UK Trip 2009
Contact Us
Web Mail
Sudoku Solver

This page is for solving standard 9*9 Sudoku problems of any difficulty. Enter the digits known into the grid, press solve, and watch it work!


A little bit of fun, and quite a nice PHP coding exercise. The code to solve the puzzle is a tiny 100 lines, and makes use of recursion.The main page is also simple set of loops to validate and display a 9*9 grid of numbers. Simple through hard examples are given (the original test data) to show how it works without all that tedious typing!

Some may consider this a brute force solution, but without getting into geeky stuff that Sudoku solvers are into, it uses quite an efficient method. It does iterate through each cell in turn, looking for cells it can solve directly (where 8 of the 9 numbers are used in the same row, column or square), and continues to iterate through them until no cells are solved. It then chooses a cell with the lowest number of possible solutions, selects the next available solution for it, and starts interating through the cells again solving all cells that can be solved. The program is recursive, in that when it next finds a situation where no cells are solved, it repeats the process for another cell with the lowest number of solutions. When it gets to a situation where a cell has no solution (all 9 numbers are used in the row column or square already) it knows that the last selection made was incorrect, and drops back to select the next available value for that cell. If all selections for that cell have been used it drops back to the previous level. Eventually, a solution is found if one exists. If more than one exists, only the first found is given.

Coming soon - a more interactive version that assists the user to solve the puzzle themselves.

Family Net
Name
Password