100 init 110 score=0 120 rem ################### map init 130 k=0 140 l=100 150 dim pat(11,11) 160 xs=100 170 zs=100 180 campos 1,-100,-120,-100 190 camrot 1,pi/12,-pi/4,0 200 ambcol 150,150,150 210 for i=1 to 11 220 for j=1 to 11 230 read pat(j,i) 240 if pat(j,i)=1 then 250 k=k+1 260 modset k+20,3,5 270 modpos k+20,i*xs,-30,j*zs 280 modopt k+20,2.5,1,0,1 290 moddisp k+20 300 else 310 l=l+1 320 modset l,3,3 330 modpos l,i*xs,70,j*zs 340 modopt l,2.5,1,0,1 350 moddisp l 360 end if 370 next j 380 next i 390 rem #################### en init 400 enum=4 410 dim ex(enum),ez(enum),ed(enum),em(enum) 420 n=200 430 for i=1 to enum 440 em(i)=1 450 n=n+1 460 do 470 x=int(rnd*6)+5 480 z=int(rnd*6)+5 490 ex(i)=x*xs 500 ez(i)=z*zs 510 mm=pat(x,z) 520 for j=1 to i-1 530 if ex(i)=ex(j) and ez(i)=ez(j) then mm=1 540 next j 550 loop while mm=1 560 modset n,7,2 570 modpos n,ex(i),0,ez(i) 580 ed(i)=rnd*pi*2 590 modrot n,0,ed(i),0 600 moddisp n 610 next i 620 rem ################## tank init 630 tx=200 640 tz=200 650 sx=-100 660 sz=-100 670 sd=0 680 td=pi 690 tcd=40 700 modrot 1,0,td,0 710 modset 1,7,1 720 modpos 1,tx,0,tz 730 moddisp 1 740 modset 2,4,10 750 modpos 2,5*xs,0,5*zs 760 modopt 2,3,1,0,1 770 moddisp 2 780 modset 3,5,1 790 rem ##################### main? 800 label main 810 cx=-tcd*sin(td) 820 cz=-tcd*cos(td) 830 campos 1,tx-cx,-20,tz-cz 840 camvec 1,cx,0,cz 850 px=pad(1,14)-127 860 py=pad(1,13)-127 870 if abs(px)>30 then 880 ppx=px/5000 890 td=td+ppx 900 if td<0 then td=td+pi*2 910 if td>pi*2 then td=td-pi*2 920 modrot 1,0,td,0 930 end if 940 if abs(py)>30 then 950 tkv=py/40 960 xx=tkv*sin(td) 970 zz=tkv*cos(td) 980 modpos 1,tx+xx,0,tz+zz 990 if collision(1,21,21+k)=0 then 1000 tx=tx+xx 1010 tz=tz+zz 1020 else 1030 tx=tx-xx 1040 tz=tz-zz 1050 modpos 1,tx,0,tz 1060 end if 1070 end if 1080 if pad(1,6)>30 and sx<0 then 1090 sx=tx 1100 sz=tz 1110 sd=td 1120 modpos 3,sx,0,sz 1130 modrot 3,0,sd,0 1140 moddisp 3 1150 elseif sx>0 then 1160 sx=sx-15*sin(sd) 1170 sz=sz-15*cos(sd) 1180 modpos 3,sx,0,sz 1190 if collision(3,21,21+k)>0 then 1200 modoff 3 1210 sx=-100 1220 else 1230 eh=collision(3,201,200+enum) 1240 if eh>0 then 1250 score=score+10 1260 modoff 3 1270 sx=-100 1280 end if 1290 end if 1300 end if 1310 if pad(1,20)=1 then end 1320 call enmove 1330 locate 0,0 1340 print"SCORE:";score 1350 fsync 1 1360 rem #################### en move 1370 sub enmove 1380 for i=1 to enum 1390 if em(i)=1 then ve=-5 else ve=3 1400 x=ve*sin(ed(i)) 1410 z=ve*cos(ed(i)) 1420 modpos 200+i,ex(i)+x,0,ez(i)+z 1430 if collision(200+i,21,21+k)>0 then 1440 modpos 200+i,ex(i),0,ez(i) 1450 em(i)=-em(i) 1460 else 1470 ex(i)=ex(i)+x 1480 ez(i)=ez(i)+z 1490 end if 1500 if em(i)=1 and rnd<0.4 then 1510 pd=pi/40 1520 if rnd<0.5 then ed(i)=ed(i)+pd else ed(i)=ed(i)-pd 1530 if ed(i)<0 then ed(i)=ed(i)+pi*2 1540 if ed(i)>pi*2 then ed(i)=ed(i)-pi*2 1550 modrot 200+i,0,ed(i),0 1560 end if 1570 next i 1580 end sub 8000 goto *main 10000 rem ######################## 10010 data 1,1,1,1,1,1,1,1,1,1,1 10020 data 1,0,0,0,0,0,0,0,0,0,1 10030 data 1,0,0,0,0,0,0,0,0,0,1 10040 data 1,0,0,1,0,0,0,1,0,0,1 10050 data 1,0,0,0,0,0,0,0,0,0,1 10060 data 1,0,0,0,0,0,0,0,0,0,1 10070 data 1,0,0,0,0,0,0,0,0,0,1 10080 data 1,0,0,1,0,0,0,1,0,0,1 10090 data 1,0,0,0,0,0,0,0,0,0,1 10100 data 1,0,0,0,0,0,0,0,0,0,1 10110 data 1,1,1,1,1,1,1,1,1,1,1