var pow=0; var delay=0; var score=0; var m_x=6,m_h=0; var q_x=26,q_h=0; var b_y=20; var start=0; var limit=3000; function draw(x,h){ var i=0; while(i<h){ lc(x,b_y-i);log(chr(158)); i=i+1; } } function next(){ cls(); q_h=rnd(10)+5; delay=rnd(limit/q_h/10-10)+1; draw(q_x,q_h); lc(q_x,b_y-q_h);log(chr(249)); pow=0; m_h=0; start=tick(); main(); } function main(){ if(btn()==1){ lc(m_x+1,b_y);log("!"); pow=pow+1; if(pow%10==0){ m_h=m_h+1; draw(m_x,m_h); } }else{ lc(m_x+1,b_y);log(" "); } var r=limit-(tick()-start); if(r<0) r=0; lc(14,3);log(" "); lc(14,3);log(r) if(r==0){ var d=m_h-q_h; if((-1<=d)*(d<=1)){ result(); } else { lc(12,10);log("GameOver"); lc(12,11);log("score : ",score,"\n"); exit(); } }else{ setTout(main,delay); } } function result(){ lc(12,10); if((m_h==q_h+1)+(m_h==q_h-1)){ score=score+1; log("GOOD. : +1"); } if(m_h==q_h){ score=score+3; log("GREAT! : +3"); } setTout(next,1500); } next();