xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

資源簡(jiǎn)介

蘭頓螞蟻(longton’s ant)的MATLAB實(shí)現(xiàn)代碼,親測(cè)可用,直接運(yùn)行,首發(fā)資源,可修改棋盤大小,可修改螞蟻的初始位置或者初始方向,可自行設(shè)置行走的次數(shù)。

資源截圖

代碼片段和文件信息

%longton‘s?ant
clear?all
s=200;??%棋盤大小
%當(dāng)前棋盤狀態(tài)
cells(1:s1:s)?=?1;?%全為白色
imh=image(cat(3cellscellscells));
set(imh?‘erasemode‘‘none‘);
axis?equal;
axis?tight;
%螞蟻位置
posx=80;
posy=100;
%頭的朝向,從頂開始順時(shí)針方向?yàn)?234
direct=1;
for?i=1:100000
????????if(cells(posxposy)==0)??%當(dāng)前棋盤為黑格
????????????if(direct==1)
?????????????????cells(posxposy)=1;
?????????????????posy=posy+1;
?????????????????posx=posx;
?????????????????direct=2;??
????elseif(direct==2)
????????cells(posxposy)=1;
????????posy=posy;
????????posx=posx+1;
????????direct=3;
??
????elseif(direct==3)
????????cells(posxposy)=1;
????????posy=posy-1;
????????posx=posx;
????????direct=4;
??????????

評(píng)論

共有 條評(píng)論