teste_map.m

来自「一个matlab的将军模型」· M 代码 · 共 43 行

M
43
字号
function teste_map()
%
% auxiliary routine used to check if there is any mapping with more than one set
% per face. In the linear case, it should not be the case.
%
% Basically the routine scans all states, checking the length of the mapping.
% null_event,time_limit, indeterminate and non_reachable states are not considered.
%

global_var;

counter=0;
for i=1:length(GLOBAL_TRANSITION)
   loc 	= GLOBAL_XSYS2AUTO_MAP{i}(1);
   if ~strcmp(loc,'terminal') & ~strcmp(loc,'out_of_bound')
      face 	= GLOBAL_XSYS2AUTO_MAP{i}(2);
      if length(GLOBAL_XSYS2AUTO_MAP{i})==3
         state = GLOBAL_XSYS2AUTO_MAP{i}(3);
         map={};
         map =GLOBAL_AUTOMATON{loc}.face{face}.state{state}.mapping;
      elseif ~strcmp(loc,'null_event')   & ...
             ~strcmp(loc,'time_limit')   & ...
             ~strcmp(loc,'indeterminate')& ...
             ~strcmp(loc,'non_reachable')
         map={};      
         map =GLOBAL_AUTOMATON{loc}.initstate{face}.mapping;
      end   
      for k = 1:length(map)
         if length(map{k})>1
            fprintf(1,'\n - found a double mapping')
            map{k}
            i
            counter = counter + 1;
         end
      end
   end
end
if ~counter
   fprintf(1,'\n - No double mapping found \n')
end

return

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?