⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 isequivalent.m

📁 一个matlab的将军模型
💻 M
字号:
function status=isequivalent(cell1,cell2)

global CELLS

status_boundary=0;
status_hpflags=0;
status_pthflags=0;
status=0;

if length(CELLS{cell1}.boundary) == length(CELLS{cell2}.boundary) 
    if all(CELLS{cell1}.boundary ==CELLS{cell2}.boundary)
        status_boundary=1;
    end
end

if length(CELLS{cell1}.hpflags) == length(CELLS{cell2}.hpflags) 
    if all(CELLS{cell1}.hpflags ==CELLS{cell2}.hpflags)
        status_hpflags=1;
    end
end

if length(CELLS{cell1}.pthflags) == length(CELLS{cell2}.pthflags) 
    if all(CELLS{cell1}.pthflags ==CELLS{cell2}.pthflags)
        status_pthflags=1;
    end
end

if status_pthflags & status_boundary & status_hpflags
    status=1;
end

if ~status;
        [C,d] = cell_ineq(CELLS{cell1}.boundary,CELLS{cell1}.hpflags);
        region1 = linearcon([],[],C,d);

        [C,d] = cell_ineq(CELLS{cell2}.boundary,CELLS{cell2}.hpflags);
        region2 = linearcon([],[],C,d);

        intersection_region=region1&region2;

    if ~isempty(intersection_region)
        if isempty(minus(region1,region2))
            if isempty(minus(region2,region1))
                status=1;
            end
        end
    end
    
end
return

⌨️ 快捷键说明

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