アットウィキロゴ

vvv7666665

var a; 
 
function sample(){
 
var timer;
var delay = 1000;
 
a=0;
b=50;
 
mode=1;
 
var loop = function () {
 
n1=6*Math.random();
n2=Math.floor(n1)+1;
 
if(mode==1)a=a+n2;
if(mode==2)a=a-n2;
b=b-1;
 
h=0;
if(mode==1)h=h+1;
if(a>100)h=h+1;
if(h==2)mode=2;
 
h=0;
if(mode==2)h=h+1;
if(a<0)h=h+1;
if(h==2)mode=1;
if(h==2)b=50;
 
 
$("#memo").html(a+","+b);  
 
clearTimeout(timer);
timer = setTimeout(loop, delay);
}
 
loop();
 
}
 
最終更新:2015年12月12日 13:33