アットウィキロゴ

pizza

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
 
var x=new Array(); 
 
function sample(){
 
for(s=1;s<11;s++){
x[s]=new Array();
}
 
 
for(s=1;s<11;s++){
for(sx=1;sx<11;sx++){
x[s][sx]=0;
}}
 
var timer;
var delay = 1000;
 
x1=1;
y1=1;
dx=1;
dy=1;
 
var loop = function () {
 
 
for(s=1;s<11;s++){
for(sx=1;sx<11;sx++){ 
x[s][sx]=0; 
}}
 
move(); 
 
x[y1][x1]=1; 
 
 paint();
 
    clearTimeout(timer);
    timer = setTimeout(loop, delay);
}
 
loop();
 
 
 
 
 
 
     }
 
 function paint(){
 
str="<table>";
for(s=1;s<11;s++){
str=str+"<tr>";
for(sx=1;sx<11;sx++){
if(x[s][sx]==1)str=str+"<td>●</td>";
if(x[s][sx]==0)str=str+"<td>□</td>";
if(x[s][sx]==2)str=str+"<td>〇</td>";
}
str=str+"</tr>";
}
 
 
 
 
 
 
     $("#memo").html(str);
 
 
 }
 function move(){
 
 if(x1>9)dx=-2;
 if(y1>9)dy=-1;
 if(x1<2)dx=2;
 if(y1<2)dy=1;
 
 x1=x1+dx;
 y1=y1+dy;
 
 if(x1>10)x1=10;
 if(y1>10)y1=10;
 if(x1<1)x1=1;
 if(y1<1)y1=1;
 
 }
 
 
 
</script>
 
最終更新:2017年08月08日 00:13