ACLS OPTION STRICT XSCREEN 1 VAR N=2,I VAR K=9e9,M=9e-31 VAR Q=1.6e-19 DIM VI[N],VJ[N] DIM X[N],Y[N] DIM SIGN[N]
DEF MOVE VAR SP=CALLIDX VAR SPDI=VI[SP],SPDJ=VJ[SP] VAR MX=X[SP],MY=Y[SP] VAR I=SP-1 MX=(MX+SPDI+400)MOD 400 MY=(MY+SPDJ+240)MOD 240 WHILE I VAR DVI=X[I]-MX,DVJ=Y[I]-MY VAR R=SQR(DVI*DVI+DVJ*DVJ) IF R!=0THEN DVI=100*DVI*K*Q*Q/R/R/R/M DVJ=100*DVJ*K*Q*Q/R/R/R/M IF SIGN[SP]!=SIGN[I]THEN SPDI=SPDI+DVI SPDJ=SPDJ+DVJ DEC VI[I],DVI DEC VJ[I],DVJ ELSE SPDI=SPDI-DVI SPDJ=SPDJ-DVJ INC VI[I],DVI INC VJ[I],DVJ ENDIF ENDIF I=I-1 WEND SPOFS SP,MX,MY X[SP]=MX:Y[SP]=MY VI[SP]=SPDI:VJ[SP]=SPDJ END FOR I=0 TO N-1 SPSET I,6 SPHOME I,8,8 X[I]=RND(400) Y[I]=RND(240) VI[I]=2*RNDF()-1 VJ[J]=2*RNDF()-1 SIGN[I]=RND(2)-1 SPFUNC I,"MOVE" NEXT I