Sudoku (Dancing Links Solver)
편집자 메모: This file was selected as MATLAB Central Pick of the Week
Game Rules:
Fill in the grid so that every row, every column, and every 3x3 box contains the digits 1 through 9.
Game Board:
The sudoku interface lets the user solve sudoku puzzles graphically. The puzzles are either generated by the built-in puzzle generator (three difficult levels can be chosen), randomly taken from the built-in database of 160 really difficult puzzles, entered manually by the or loaded from three standard ascii sudoku files 'Simple Sudoku' (.ss), 'Sudoku Puzzle' (.sdk) or 'Sudoku Puzzle Collection' (.sdm).
The game board can be saved to Simple Sudoku and Sudoku Puzzle files.
The current board can also be exported to various image-files, such as, png, bmp, eps or tiff. The board can be printed and also copied to clipboard to be pasted as an image in for example a MS Word document.
Game Controls:
The sudoku game can be played using either mouse or keyboard (or both). Move around marker using arrow keys and add a number using number keys. Delete, backspace or 0 (zero) will remove number from board. With mouse you move around marker using left-click and reach a context-menu with number choices using right-click.
Illegal characters can not be entered.
Game Solver:
The sudoku game has two built-in puzzle solvers, one quick and one 'human-like'. The quick one is based on Dancing Links (DLX), a technique suggested by Donald Knuth to efficiently implement his Algorithm X. Algorithm X is a recursive, nondeterministic, depth-first, brute-force algorithm that finds all solutions to the exact cover problem. The human solver finds Naked Singles, Hidden Singles, Naked Pairs and Locked Candidates 1 and 2. If this is not enough it takes a guess and tries to solve it recursively.
The dlx-solver is used for solving and generating puzzles while the human puzzle is used to generate a log of solution steps.
The game allows for automatic solving of the whole puzzle or just one single square. To help the user one can show all possible candidates for unfilled squares as well as showing all mistakes in a different color as well as making it impossible to make an illegal mark.
Extra Game Features:
The sudoku game has Undo and Redo functionality that can be reached from the Edit-menu, Context-menu or by the shortcuts Ctrl-Z (Undo) and Ctrl-R (Redo).
Every time one restarts a game a timer is started. Current time can be shown using Ctrl-T or enable/disabled from the Help menu.
A coloring help of possible candidates can be added to the matrix from the colored numbers in the toolbar.
Example:
sudoku % Start Main Sudoku Interface
sudoku('uitest') % Solve all 160 boards in database (test set)
인용 양식
Per-Anders Ekstrom (2024). Sudoku (Dancing Links Solver) (https://www.mathworks.com/matlabcentral/fileexchange/14073-sudoku-dancing-links-solver), MATLAB Central File Exchange. 검색 날짜: .
MATLAB 릴리스 호환 정보
플랫폼 호환성
Windows macOS Linux태그
도움
도움 받은 파일: Sudoku! (v3.4)
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!버전 | 게시됨 | 릴리스 정보 | |
---|---|---|---|
1.0.0.0 | Enhanced the toolbar to use a real toolbar. |