View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

3.8 | 6 ratings Rate this file 3 Downloads (last 30 days) File Size: 4.66 KB File ID: #12096 Version:




30 Aug 2006 (Updated )

Web Sudoku solver, using MATLAB algorithm as a .NET component created by MATLAB Builder for .NET, wi

| Watch this File

File Information

SOLVE_SUDOKU.M -- This file contains the code for solving the Sudoku board, and should be deployed as a .NET assembly. It accepts as input a 9-by-9 array, where 0 represents a blank square, and the digits 1-9 represent any initial values in the grid. The function returns the solved board, if a solution exists, and a flag indicating whether the code was successful at finding a solution. To solve the puzzle, the code uses an algorithm that makes recursive calls to the solver function after choosing one of the possible candidates for a square. If a square does not have any possible candidates, the algorithm backs up to a previous square, and tries another possible candidate there before proceeding.
SUDOKU.ASPX -- The front-end web page is an ASP.NET file that creates a 9-by-9 grid of text boxes, allowing users to enter the values for a Sudoku puzzle. After a user clicks the submit button, this code posts the data in the grid to solver.aspx.

SOLVER.ASPX -- This ASP.NET code accepts the input data from sudoku.aspx, packages it in a .NET array, and calls a method of the Sudoku object to solve the puzzle. After receiving the output in the form of a two-dimensional array, the ASP.NET code formats the array to display the solution on the screen.

For more information on solving Sudoku puzzles, check out the following reference:
Delahaye, Jean-Paul. "The Science Behind Sudoku." Scientific American June 2006: 81-83.

Note: Certain boards take longer to solve than others. It may be helpful to set the timeout for the ASP.NET page appropriately for boards that take an excessive amount of time to complete.

Required Products MATLAB Builder NE
MATLAB Compiler
MATLAB release MATLAB 7.2 (R2006a)
Other requirements Microsoft .NET Framework 1.1 (R2006a or R2006b), or 2.0 (R2006b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (8)
02 Oct 2009 Chamane

really nice!

03 Jul 2008 Jerry Gao

Hi, I am using Visual Studio, How do I place the SOLVE_SUDOKU.M file in the solution resource manager? many thanks.

Comment only
17 Mar 2008 li TONY

it's ok

20 Dec 2007 marutha nayakam

21 May 2007 Daniela Macena

how I make to see the program correctly? I need to make some configuration in the Web.config or the Assemby ?


Comment only
18 Nov 2006 Roxana Vasiliu

18 Nov 2006 basma hussien

15 Oct 2006 Richard Lonscak

28 Jul 2009 1.2

Added BSD license.

22 Dec 2009 1.4

Updated information in readme file.

01 Sep 2016

Updated license

Contact us