资源简介
非常智能的求解数独的MATLAB程序。无任何BUG
代码片段和文件信息
function sudokue(varargin)
% SUDOKUE play sudoku with MATLAB (aids for solving included)
%
% A guide on how sudoku works can be found e.g. on
% http://en.wikipedia.org/wiki/Sudoku
%
% This program has a history-function i.e. you can undo and redo each
% single step. You can also save and load a score including all settings
% (execpt for the branching solver).
%
% New games can be imported either as ASCII-string or from sdm- or
% sdk-files resprectively. Puzzles in ASCII-Format or as sdm- or sdk-file
% respectively can be found e.g. on http://www.sudocue.net/
%
% Aids for solving the puzzle can be found on the menu entry “solver“: If
% you enable tooltips then all possible numbers for each fields are
% shown as tooltip when mouse cursor is placed over the corresponding
% field. There is a semiautomatic which shows all fields whose solution
% is unique regarding the logical constraints but in opposite to the
% automatic solver the values are just taken if one clicks on it. In
% addition to the automatik solver which just evaluates the logical
% constraints there is an additional branching algorithm implemented
% who solves any arbitrary sudoku. This algorithm will not check whether
% this solution is unique but it is guaranteed that the solution is
% valid.
% (c) Matthias Schwaiger 2007
%
sudoku_version=‘$Revision: 1.1 $‘;
sudoku_datum=‘$Date: 2007/01/15 07:19:00 $‘;
userdata.version=sudoku_version(12:length(sudoku_version)-2);
userdata.datum=sudoku_datum(8:length(sudoku_datum)-2);
if nargin > 0 && ~isempty(findobj(‘tag‘mfilename))
sudoku_cb(varargin{1});
return
end
if ~isempty(findobj(‘tag‘mfilename))
figure(findobj(‘tag‘mfilename));
return
end
sudoku_scr=get(0‘screensize‘);
sudoku_fig_width=360;
sudoku_fig_height=300;
sudoku_fig=figure(‘menubar‘‘none‘ ‘numbertitle‘‘off‘ ...
‘position‘[(sudoku_scr(3)-sudoku_fig_width)/2 (sudoku_scr(4)-sudoku_fig_height)/2 sudoku_fig_width sudoku_fig_height]...
‘resize‘‘off‘ ...
‘tag‘mfilename‘CloseRequestFcn‘[mfilename ‘(103);‘]);
eval(‘set(sudoku_fig‘‘DockControl‘‘‘‘off‘‘)‘‘‘);
feldanteil=0.9;
statusleistenhoehe=0.07;
for k=1:9
for m=1:9
sudoku_feld((k-1)*9+m)=uicontrol(‘parent‘ sudoku_fig ‘units‘ ‘normalized‘ ‘style‘‘edit‘...
‘fontsize‘12‘fontweight‘‘bold‘‘Horizontalalignment‘‘center‘‘Backgroundcolor‘[0.7 0.7 0.7]...
‘position‘[(1-feldanteil)/10+(m-1)*((feldanteil/9)+(1-feldanteil)/10) ...
1-(feldanteil/9)*(1-statusleistenhoehe)-((1-feldanteil)/10+(k-1)*((feldanteil/9)*(1-statusleistenhoehe)+(1-feldanteil)/10)) ...
(feldanteil/9) (feldanteil/9)*(1-statusleistenhoehe)]);%#ok
if floor(((floor((k-1)/3)+1)+(floor((m-1)/3)+1))/2)==((floor((k-1)/3)+1)+(floor((m-1)/3)+1))/2
set (sudoku_feld((k-1)*9+m)‘Backgroundcolor‘[0.
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 24785 2013-03-27 21:25 Sodoku\sudokue.m
文件 4761 2013-03-27 21:26 Sodoku\sudokusolve.m
文件 667 2013-03-27 21:24 Sodoku\sudoku_construct.m
目录 0 2013-03-27 21:26 Sodoku
----------- --------- ---------- ----- ----
30213 4
- 上一篇:拉普拉斯边缘检测算子matlab源程序
- 下一篇:matlab虹膜识别
相关资源
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
- k近邻算法matlab实现
- matlab识别系统
- 神经网络分类matlab程序
- matlab正弦信号发生器的设计
- matlab程序用Hopfield网络解决TSP
- 实例matlab 编程100个常用程序
- 用MATLAB(BPSK仿真 直接扩频)
- 最小二乘法曲线拟合(MATLAB)
评论
共有 条评论