資源簡介
非常智能的求解數(shù)獨的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虹膜識別
評論
共有 條評論