谷速软件编程matlab源码汉诺塔游戏攻略动画演示.docx

上传人:b****4 文档编号:12314238 上传时间:2023-04-18 格式:DOCX 页数:20 大小:17.24KB
下载 相关 举报
谷速软件编程matlab源码汉诺塔游戏攻略动画演示.docx_第1页
第1页 / 共20页
谷速软件编程matlab源码汉诺塔游戏攻略动画演示.docx_第2页
第2页 / 共20页
谷速软件编程matlab源码汉诺塔游戏攻略动画演示.docx_第3页
第3页 / 共20页
谷速软件编程matlab源码汉诺塔游戏攻略动画演示.docx_第4页
第4页 / 共20页
谷速软件编程matlab源码汉诺塔游戏攻略动画演示.docx_第5页
第5页 / 共20页
点击查看更多>>
下载资源
资源描述

谷速软件编程matlab源码汉诺塔游戏攻略动画演示.docx

《谷速软件编程matlab源码汉诺塔游戏攻略动画演示.docx》由会员分享,可在线阅读,更多相关《谷速软件编程matlab源码汉诺塔游戏攻略动画演示.docx(20页珍藏版)》请在冰豆网上搜索。

谷速软件编程matlab源码汉诺塔游戏攻略动画演示.docx

谷速软件编程matlab源码汉诺塔游戏攻略动画演示

hf=figure('name','汉诺塔游戏仿真');   %加标题

axis([0,12,0,12]);    %画坐标

set(hf,'color','w');      %填充背景

holdon;      %保持图形

axis('off');      %隐藏网络线

rectangle('position',[0,0,12,0.5],'FaceColor',[0,1.0,0]);   %画底版

line([3;3],[0.5,8],'color','r','linestyle','-','linewidth',1.5);

line([6;6],[0.5,8],'color','r','linestyle','-','linewidth',1.5);

line([9;9],[0.5,8],'color','r','linestyle','-','linewidth',1.5);   %画出三条路线

a=line([3;3],[0.5,1.0],'color','c','linestyle','-','linewidth',65);%画出一号长方体木块

b=line([3;3],[1.0,1.5],'color','b','linestyle','-','linewidth',45);%画出二号长方体木块

c=line([3;3],[1.5,2.0],'color','k','linestyle','-','linewidth',30);%画出三号长方体木块

d=line([3;3],[2.0,2.5],'color','y','linestyle','-','linewidth',25);%画出四号长方体木块

e=line([3;3],[2.5,3.0],'color','m','linestyle','-','linewidth',15);%画出五号长方体木块

  %设置五木板的运动

%设置五号长方体木块的运动,竖直向上运动到第一条路线的最上方

t1=2.5; dt=0.05;

whilet1<=8

   t1=t1+dt;

   set(e,'xdata',[3;3],'ydata',[t1;t1+0.5]);

   drawnow;   

set(gcf,'doublebuffer','on');   %消除震动

end   

%设置五号长方体木块的运动,水平运动到第三条路线的最上方

t2=3;  dt=0.05;

whilet2<=9

   t2=t2+dt;

   set(e,'xdata',[t2;t2],'ydata',[t1;t1+0.5]);

   drawnow;    set(gcf,'doublebuffer','on');   %消除震动

end       

%设置五号长方体木块的运动,竖直向下运动到第三条路线的下方    

t3=8;  dt=0.05;

whilet3>=0.5

   t3=t3-dt;

   set(e,'xdata',[9;9],'ydata',[t3;t3+0.5]);

   drawnow;    

set(gcf,'doublebuffer','on');   %消除震动

end          

%设置四号长方体木块的运动,竖直向上运动到第一条路线的最上方

t4=2.0;  dt=0.05;

whilet4<=8

   t4=t4+dt;

   set(d,'xdata',[3;3],'ydata',[t4;t4+0.5]);

   drawnow;   

set(gcf,'doublebuffer','on');   %消除震动

end          

%设置四号长方体木块的运动,水平运动到第二条路线的最上方

t5=3;  dt=0.05;

whilet5<=6

   t5=t5+dt;

   set(d,'xdata',[t5;t5],'ydata',[t4;t4+0.5]);

   drawnow;   set(gcf,'doublebuffer','on');   %消除震动

end    

%设置四号长方体木块的运动,竖直向下运动到第二条路线的最下方      

t6=8;  dt=0.05;

whilet6>=0.5

   t6=t6-dt;

   set(d,'xdata',[6;6],'ydata',[t6;t6+0.5]);

   drawnow; 

set(gcf,'doublebuffer','on');   %消除震动

end       

%设置五号长方体木块的运动,竖直向上运动到第三条路线的最上方

t7=0.5;  dt=0.05;

whilet7<=8

   t7=t7+dt;

   set(e,'xdata',[9;9],'ydata',[t7;t7+0.5]);

   drawnow;   

set(gcf,'doublebuffer','on');   %消除震动

end       

%设置五号长方体木块的运动,水平运动到第二条路线的最上方  

t8=9;  dt=0.05;

whilet8>=6

   t8=t8-dt;

   set(e,'xdata',[t8;t8],'ydata',[t7;t7+0.5]);

   drawnow;     

set(gcf,'doublebuffer','on');   %消除震动

end        

%设置五号长方体木块的运动,竖直向下运动到第二条路线的下方  

t9=8;   dt=0.05;

whilet9>=1.0

   t9=t9-dt;

   set(e,'xdata',[6;6],'ydata',[t9;t9+0.5]);

   drawnow;  

set(gcf,'doublebuffer','on');   %消除震动

end          

%设置三号长方体木块的运动,竖直向上运动到第一条路线的上方

t10=1.5;   dt=0.05;

whilet10<=8

   t10=t10+dt;

   set(c,'xdata',[3;3],'ydata',[t10;t10+0.5]);

   drawnow;    

set(gcf,'doublebuffer','on');   %消除震动

end        

%设置三号长方体木块的运动,水平运动到第三条路线的上方

t11=3;   dt=0.05;

whilet11<=9

   t11=t11+dt;

   set(c,'xdata',[t11;t11],'ydata',[t10;t10+0.5]);

   drawnow;   

set(gcf,'doublebuffer','on');   %消除震动

end        

 %设置三号长方体木块的运动,竖直向下运动到第三条路线的下方

t12=8;   dt=0.05;

whilet12>=0.5

   t12=t12-dt;

   set(c,'xdata',[9;9],'ydata',[t12;t12+0.5]);

   drawnow;   

set(gcf,'doublebuffer','on');   %消除震动

end    

%设置五号长方体木块的运动,竖直向上运动到第二条路线的上方   

t13=1;  dt=0.05;

whilet13<=8

   t13=t13+dt;

   set(e,'xdata',[6;6],'ydata',[t13;t13+0.5]);

   drawnow;   

set(gcf,'doublebuffer','on');   %消除震动

end     

%设置五号长方体木块的运动,水平运动到第一条路线的最上方   

t14=6;  dt=0.05;

whilet14>=3

   t14=t14-dt;

   set(e,'xdata',[t14;t14],'ydata',[8;8+0.5]);

   drawnow;

  set(gcf,'doublebuffer','on');   %消除震动

end          

%设置五号长方体木块的运动,竖直向下运动到第一条路线的下方

t15=8;  dt=0.05;

whilet15>=1.5

   t15=t15-dt;

   set(e,'xdata',[3;3],'ydata',[t15;t15+0.5]);

   drawnow;

 set(gcf,'doublebuffer','on');   %消除震动

end     

%设置四号长方体木块的运动,竖直向上运动到第二条路线的上方    

t16=0.5; dt=0.05;

whilet16<=8

   t16=t16+dt;

   set(d,'xdata',[6;6],'ydata',[t16;t16+0.5]);

   drawnow;  

set(gcf,'doublebuffer','on');   %消除震动

end          

%设置四号长方体木块的运动,水平运动到第三条路线的上方

t17=6;  dt=0.05;

whilet17<=9

   t17=t17+dt;

   set(d,'xdata',[t17;t17],'ydata',[8;8.5]);

   drawnow;

   set(gcf,'doublebuffer','on');   %消除震动

end    

%设置四号长方体木块的运动,竖直向下运动到第三条路线的下方    

t18=8;dt=0.05;

whilet18>=1

   t18=t18-dt;

   set(d,'xdata',[9;9],'ydata',[t18;t18+0.5]);

   drawnow;

set(gcf,'doublebuffer','on');   %消除震动

end         

%设置五号长方体木块的运动,竖直向上运动到第一条路线的上方

t19=1.0;dt=0.05;

whilet19<=8

   t19=t19+dt;

   set(e,'xdata',[3;3],'ydata',[t19;t19+0.5]);

   drawnow;

set(gcf,'doublebuffer','on');   %消除震动

end         

 %设置五号长方体木块的运动,水平运动到第三条路线的上方

t20=3;dt=0.05;

whilet20<=9

   t20=t20+dt;

   set(e,'xdata',[t20;t20],'ydata',[8;8.5]);

   drawnow;

set(gcf,'doublebuffer','on');   %消除震动

end    

%设置五号长方体木块的运动,竖直向下运动到第三条路线的下方

t21=8;dt=0.05;

whilet21>=1.5

   t21=t21-dt;

   set(e,'xdata',[9;9],'ydata',[t21;t21+0.5]);

   drawnow;

   set(gcf,'doublebuffer','on');   %消除震动

end  

%设置二号长方体木块的运动,竖直向上运动到第一条路线的上方

t22=1.0; dt=0.05;

whilet22<=8

   t22=t22+dt;

   set(b,'xdata',[3;3],'ydata',[t22;t22+0.5]);

   drawnow;   

set(gcf,'doublebuffer','on');   %消除震动

end   

%设置二号长方体木块的运动,水平运动到第二条路线的上方

t23=3;  dt=0.05;

whilet23<=6

   t23=t23+dt;

   set(b,'xdata',[t23;t23],'ydata',[t22;t22+0.5]);

   drawnow;    set(gcf,'doublebuffer','on');   %消除震动

end       

%设置二号长方体木块的运动,竖直向下运动到第二条路线的最下方    

t24=8;  dt=0.05;

whilet24>=0.5

   t24=t24-dt;

   set(b,'xdata',[6;6],'ydata',[t24;t24+0.5]);

   drawnow;    

set(gcf,'doublebuffer','on');   %消除震动

end        

%设置五号长方体木块的运动,竖直向上运动到第三条路线的上方

t25=1.5; dt=0.05;

whilet25<=8

   t25=t25+dt;

   set(e,'xdata',[9;9],'ydata',[t25;t25+0.5]);

   drawnow;   

set(gcf,'doublebuffer','on');   %消除震动

end   

%设置五号长方体木块的运动,水平运动到第二条路线的上方

t26=9;  dt=0.05;

whilet26>=6

   t26=t26-dt;

   set(e,'xdata',[t26;t26],'ydata',[t25;t25+0.5]);

   drawnow;    set(gcf,'doublebuffer','on');   %消除震动

end       

%设置五号长方体木块的运动,竖直向下运动到第二条路线的下方    

t27=8;  dt=0.05;

whilet27>=1.0

   t27=t27-dt;

   set(e,'xdata',[6;6],'ydata',[t27;t27+0.5]);

   drawnow;    

set(gcf,'doublebuffer','on');   %消除震动

end       

%设置四号长方体木块的运动,竖直向上运动到第三条路线的上方

t28=1.5; dt=0.05;

whilet28<=8

   t28=t28+dt;

   set(d,'xdata',[9;9],'ydata',[t28;t28+0.5]);

   drawnow;   

set(gcf,'doublebuffer','on');   %消除震动

end

%设置四号长方体木块的运动,水平运动到第一条路线的上方

t29=9;  dt=0.05;

whilet29>=3

   t29=t29-dt;

   set(d,'xdata',[t29;t29],'ydata',[t28;t28+0.5]);

   drawnow;    set(gcf,'doublebuffer','on');   %消除震动

end       

%设置四号长方体木块的运动,竖直向下运动到第一条路线的下方    

t30=8;  dt=0.05;

whilet30>=1.0

   t30=t30-dt;

   set(d,'xdata',[3;3],'ydata',[t30;t30+0.5]);

   drawnow;    

set(gcf,'doublebuffer','on');   %消除震动

end 

%设置五号长方体木块的运动,竖直向上运动到第二条路线的上方

t31=1.0; dt=0.05;

whilet31<=8

   t31=t31+dt;

   set(e,'xdata',[6;6],'ydata',[t31;t31+0.5]);

   drawnow;   

set(gcf,'doublebuffer','on');   %消除震动

end   

%设置五号长方体木块的运动,水平运动到第一条路线的上方

t32=6;  dt=0.05;

whilet32>=3

   t32=t32-dt;

   set(e,'xdata',[t32;t32],'ydata',[t31;t31+0.5]);

   drawnow;    set(gcf,'doublebuffer','on');   %消除震动

end       

%设置五号长方体木块的运动,竖直向下运动到第一条路线的下方    

t33=8;  dt=0.05;

whilet33>=1.5

   t33=t33-dt;

   set(e,'xdata',[3;3],'ydata',[t33;t33+0.5]);

   drawnow;    

set(gcf,'doublebuffer','on');   %消除震动

end 

%设置三号长方体木块的运动,竖直向上运动到第三条路线的上方

t34=0.5; dt=0.05;

whilet34<=8

   t34=t34+dt;

   set(c,'xdata',[9;9],'ydata',[t34;t34+0.5]);

   drawnow;   

set(gcf,'doublebuffer','on');   %消除震动

end   

%设置三号长方体木块的运动,水平运动到第二条路线的上方

t35=9;  dt=0.05;

whilet35>=6

   t35=t35-dt;

   set(c,'xdata',[t35;t35],'ydata',[t34;t34+0.5]);

   drawnow;    set(gcf,'doublebuffer','on');   %消除震动

end       

%设置三号长方体木块的运动,竖直向下运动到第二条路线的下方    

t36=8;  dt=0.05;

whilet36>=1.0

   t36=t36-dt;

   set(c,'xdata',[6;6],'ydata',[t36;t36+0.5]);

   drawnow;    

set(gcf,'doublebuffer','on');   %消除震动

end    

%设置五号长方体木块的运动,竖直向上运动到第三条路线的上方

t37=1.5; dt=0.05;

whilet37<=8

   t37=t37+dt;

   set(e,'xdata',[3;3],'ydata',[t37;t37+0.5]);

   drawnow;   

set(gcf,'doublebuffer','on');   %消除震动

end   

%设置五号长方体木块的运动,水平运动到第三条路线的最上方

t38=3;  dt=0.05;

whilet38<=9

   t38=t38+dt;

   set(e,'xdata',[t38;t38],'ydata',[t37;t37+0.5]);

   drawnow;    set(gcf,'doublebuffer','on');   %消除震动

end       

%设置五号长方体木块的运动,竖直向下运动到第三条路线的下方    

t39=8;  dt=0.05;

whilet39>=0.5

   t39=t39-dt;

   set(e,'xdata',[9;9],'ydata',[t39;t39+0.5]);

   drawnow;    

set(gcf,'doublebuffer','on');   %消除震动

end 

%设置四号长方体木块的运动,竖直向上运动到第二条路线的上方

t40=2.5; dt=0.05;

whilet40<=8

   t40=t40+dt;

   set(d,'xdata',[3;3],'ydata',[t40;t40+0.5]);

   drawnow;   

set(gcf,'doublebuffer','on');   %消除震动

end   

%设置四号长方体木块的运动,水平运动到第二条路线的最上方

t41=3;  dt=0.05;

whilet41<=6

   t41=t41+dt;

   set(d,'xdata',[t41;t41],'ydata',[t40;t40+0.5]);

   drawnow;    set(gcf,'doublebuffer','on');   %消除震动

end       

%设置四号长方体木块的运动,竖直向下运动到第二条路线的下方    

t42=8;  dt=0.05;

whilet42>=1.5

   t42=t42-dt;

   set(d,'xdata',[6;6],'ydata',[t42;t42+0.5]);

   drawnow;    

set(gcf,'doublebuffer','on');   %消除震动

end 

%设置五号长方体木块的运动,竖直向上运动到第三条路线的上方

t43=0.5; dt=0.05;

whilet43<=8

   t43=t43+dt;

   set(e,'xdata',[9;9],'ydata',[t43;t43+0.5]);

   drawnow;   

set(gcf,'doublebuffer','on');   %消除震动

end   

%设置五号长方体木块的运动,水平运动到第二条路线的最上方

t44=9;  dt=0.05;

whilet44>=6

   t44=t44-dt;

   set(e,'xdata',[t44;t44],'ydata',[t43;t43+0.5]);

   drawnow;    set(gcf,'doublebuffer','on');   %消除震动

end       

%设置五号长方体木块的运动,竖直向下运动到第二条路线的下方    

t45=8;  dt=0.05;

whilet45>=2.0

   t45=t45-dt;

   set(e,'xdata',[6;6],'ydata',[t45;t45+0.5]);

   drawnow;    

set(gcf,'doublebuffer','on');   %消除震动

end   

%设置一号长方体木块的运动,竖直向上运动到第一条路线的上方

t46=0.5; dt=0.05;

whilet46<=8

   t46=t46+dt;

   set(a,'xdata',[3;3],'ydata',[t46;t46+0.5]);

   drawnow

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 商务科技

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1