var time=0; var pow=0; var u_x=15; var u_y=10; var a_x=0; var a_y=0; var c_usao=235; var c_cup=255; function aim(){ lc(a_x,a_y);log(" "); var add_x,add_y; if((a_x<=0)*(a_y<=1)){ add_x=1; add_y=0; } if((a_x>=31)*(a_y<=1)){ add_x=0; add_y=1; } if((a_x<=0)*(a_y>=22)){ add_x=0; add_y=-1; } if((a_x>=31)*(a_y>=22)){ add_x=-1; add_y=0; } if((0<a_x)*(a_x<31)){ if(a_y<=1) add_x=1; if(a_y>=22) add_x=-1; add_y=0; } if((1<a_y)*(a_y<22)){ if(a_x<=1) add_y=-1; if(a_x>=31) add_y=1; add_x=0; } a_x=a_x+add_x; a_y=a_y+add_y; lc(a_x,a_y);log(chr(227)); } function cup(){ var x=u_x; var y=u_y; while((x==u_x)*(y==u_y)){ x=rnd(30)+1; y=rnd(20)+2; } lc(x,y);log(chr(c_cup)); } function moveU(){ lc(u_x,u_y);log(" "); var dx=(u_x<a_x)*(u_x<30)-(u_x>a_x)*(u_x>1); var dy=(u_y<a_y)*(u_y<21)-(u_y>a_y)*(u_y>2); if((dx!=0)*(dy!=0)){ if(rnd(2)== 0){ u_x=u_x+dx; }else{ u_y=u_y+dy; } }else{ u_x=u_x+dx; u_y=u_y+dy; } if(scr(u_x,u_y)==c_cup){ pow=pow+25; cup(); } lc(u_x,u_y);log(chr(c_usao)); } function clear(){ lc(u_x+1,u_y);log("<I'm BIG!"); var i=1; while(i<4){ var j=-1; while(j<2){ lc(u_x+j,u_y+i);log(chr(143)); j=j+1; } i=i+1; } exit(0); } function init(){ cls(); time=0; pow=0; a_x=0; a_y=1; u_x=15; u_y=10; cup(); aim(); moveU(); } function main(){ time=time+1; lc(0,0);log("time:",time," ","pow:",pow,"%"); if(pow==100) clear(); moveU(); setTout(main,200); } init(); setBprs(aim); main();