open window 640,512:window origin "cc"
tx1=-100:ty1=0:sc1=0:s1=20:tx2=100:ty2=0:sc2=0:s2=20
ox=0:oy=0:t=3000:xa=0:ya=0:m=pi/180
repeat:setdispbuf cb:cb=1-cb:setdrawbuf cb:clear window
ox=cos(xa*m)*200:oy=sin(ya*m)*200:tt=int(t/50)
setrgb 1,255,255,0:fill circle ox,oy,5
setrgb 1,0,0,255:rect tx1-s1,ty1-s1 to tx1+s1,ty1+s1
text -300,-240,"Score :"+str$(sc1),"lb"
setrgb 1,0,255,0:rect tx2-s2,ty2-s2 to tx2+s2,ty2+s2
text 300,-240,"Score :"+str$(sc2),"rb"
setrgb 1,255,255,255:text 0,0,"Time :"+str$(tt),"cc"
xa=xa+ran(12)-4:ya=ya+ran(12)-4
j1=peek("port1"):j2=peek("port2")
if and(j1,16)>0 ty1=ty1-5:if and(j1,64)>0 ty1=ty1+5
if and(j1,32)>0 tx1=tx1+5:if and(j1,128)>0 tx1=tx1-5
if and(j1,16384)>0 and abs(tx1-ox)<s1 and abs(ty1-oy)<s1 then
 sc1=sc1+1:xa=ran(360):ya=ran(360):s1=s1-0.25:beep
fi
if and(j2,16)>0 ty2=ty2-5:if and(j2,64)>0 ty2=ty2+5
if and(j2,32)>0 tx2=tx2+5:if and(j2,128)>0 tx2=tx2-5
if and(j2,16384)>0 and abs(tx2-ox)<s2 and abs(ty2-oy)<s2 then
 sc2=sc2+1:xa=ran(360):ya=ran(360):s2=s2-0.25:beep
fi
t=t-1:until (t=0):setdispbuf cb:setdrawbuf cb
text 0,40,"Game Over","cc":repeat until (1=2)
