Code covered by the BSD License  

Highlights from
Powerful Sudoku Solver

Be the first to rate this file! 6 Downloads (last 30 days) File Size: 3.49 KB File ID: #21576

Powerful Sudoku Solver

by Janardhanan Sivaramakrishnan

 

25 Sep 2008 (Updated 06 Oct 2008)

A function that solves everything but the toughest of sudoku puzzles

| Watch this File

File Information
Description

SUDOKU_LVL2 - A Sudoku Solver.
 
Usage : Sol=sudoku_lvl2(A)
Where A is a incomplete sudoku grid (9 x 9) represented as a 9 x 9 matrix of integers (0-9) with the empty cells being filled with zeros.

The algorithm presented here uses the following techniques.
(*) Filling a cell by candidate elimination
(*) Filling a cell by position exclusion for a given candidate
(*) Refining choices of candidates in a given cell by eliminating members
of locked pairs, locked triplets and so on..
(*) Filling the remaining cells by brute force method.
 
First 3 algorithms are of my own logic. The brute force algorithm is a big improvement over '8466'.

Note : Please note that the aim of this algorithm is to have the most comprehensive logic while trying to have a decent speed. Speed, though, is not the primary criterion.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
MATLAB Sodoku Solver - Improved

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
26 Sep 2008

Improved speed of subroutine brute_force by pre sorting length of candidates list.

03 Oct 2008

Added a subroutine refine_again for further refining of candidate choices.

Changed Description slightly.

Modified algorithms to perform refinement only for unsolved sudokus (thus improve speed).

06 Oct 2008

Did not know the reason...but the m file was missing. So, uploading it again.

06 Oct 2008

Updated some code.

Tag Activity for this File
Tag Applied By Date/Time
games Janardhanan Sivaramakrishnan 22 Oct 2008 10:21:37
sudoku Janardhanan Sivaramakrishnan 22 Oct 2008 10:21:37
puzzle solver Janardhanan Sivaramakrishnan 22 Oct 2008 10:21:37
matrix Janardhanan Sivaramakrishnan 22 Oct 2008 10:21:37
algorithm Janardhanan Sivaramakrishnan 22 Oct 2008 10:21:37
sudoku Erhan 01 Nov 2011 16:50:14

Contact us at files@mathworks.com