Sudoku: ASP.NET/MATLAB
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.
引用格式
John Kotwicki (2024). Sudoku: ASP.NET/MATLAB (https://www.mathworks.com/matlabcentral/fileexchange/12096-sudoku-asp-net-matlab), MATLAB Central File Exchange. 检索来源 .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!