资源简介
非常智能的求解数独的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虹膜识别
相关资源
- 线结构光中心提取算法matlab
- 基线解算的matlab源码
- 基于相位相关的图像平移检测算法m
- 指静脉处理代码
- SIMPLE算法Matlab代码
- 《无人驾驶车辆模型预测控制》书中
- 基于SIFT特征的图像配准MATLAB代码
- 多目标遗传算法matlab程序
- 布谷鸟算法的matlab代码
- MATLAB+背景减除目标检测+鱼头截取
- matlab实现文件读写波形处理,小波变
- RBF神经网络的训练 MATLAB源程序代码
- SMO_matlabfunction.rar
- agent蜂拥的实现matlab
- 如何自定义一个神经网络
- 万有引力搜索算法(Matlab)
- 标准差分进化算法多目标线性规划的
- matlab完整GUI 源程序免费
- matlab神经网络资料
- matlab,深度图转换三维点云,depthma
- matlab生成ply程序
- 测井曲线的MATLAB绘制
- 最大后验实现图像盲复原
- 小波变换 matlab程序
- SVM用于故障诊断的实现
- 基于遗传算法的投影寻踪模型Matlab源
- labview matlab 小波去噪
- 自适应控制算法-matlab编程实现
- 油位计仪表盘识别matlab代码实现
- 罚函数matlab实现
评论
共有 条评论