您当前的位置: 首页 >  游戏

jeff one

暂无认证

  • 0浏览

    0关注

    220博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

matlab实现扫雷小游戏

jeff one 发布时间:2022-03-18 13:49:32 ,浏览量:0

matlab实现扫雷小游戏

主语:

clear all;
row=10;
col=10;
num=30;
jieshu=0;
%global flag;
flag=zeros(row,col);
%生成0矩阵
flag1=ones(row,col);
%生成1矩阵
minenum=zeros(row,col);
%生成0矩阵
minefield=rand(row,col);
%生成随机矩阵
[temp,index]=sort(minefield(:));
minefield=(minefield0&&y1>0
          if minefield(x1,y1)==1
              count=count+1;
          end
      end
      if x2>1
          if minefield(x2,y2)==1
              count=count+1;
          end
      end
      if x3>0&&y30
          if minefield(x4,y4)==1
              count=count+1;
          end
      end
      if y50&&nf30 && flag(mf4,nf4)==0
    flag(mf4,nf4)=1;
    if minenum(mf4,nf4)==0
        set(h(mf4,nf4),'style','text','string','','backgroundcolor',[0 0 0]);
    else
    set(h(mf4,nf4),'string',num2str(minenum(mf4,nf4)));
    end
    set(h(mf4,nf4), 'foregroundColor',0.1*[1,1,1]);
    set(h(mf4,nf4),'style','text','backgroundcolor',[1 1 1]);
    
    if minenum(mf4,nf4)==0
        search(mf4,nf4,minenum,h,minefield,flag,jieshu);
    end    
    set(h(mf4,nf4),'value',1);
end
if nf5            
关注
打赏
1661150981
查看更多评论
0.0561s