10 'ELECTRON.BAS 08/03/1988 REVISED 03 JAN 1995 (Formerly PESRITZ.BAS) 'IDELAY, IDELMIN, IDELMAX, and J changed to 'DELAY!, DELMIN!, DELMAX!, and DJ! on 24 May 2007 'Operational dely calculations were overflowing 30 cls:print print " ΙΝΝΝΝΝΝΝΝΝ» " print " ΘΝΝΝ» ΙΝΝΝΌ " print " ΙΝ» ΙΝΝΝΝΝΝΝΝΝ» ΙΝ» ΙΝ» Ί Ί ΙΝΝΝΝΝΝΝΝ» ΙΝΝΝΝΝΝΝΝ» " print " Ί Ί Ί ΙΝΝΝΝΝ» Ί Ί Ί Ί Ί Ί Ί Ί ΙΝΝΝΝ» Ί Ί ΙΝΝΝΝΝΝΌ " print " Ί Ί Ί Ί Ί Ί Ί Ί ΙΝ» Ί Ί ΙΝΝ» Ί Ί Ί ΘΝΝΝΝΌ Ί Ί Ί " print " Ί Ί Ί Ί Ί Ί Ί Ί Ί Ί Ί Ί ΘΝΝΌ Ί Ί Ί ΙΝΝΝΝΝΝΌ Ί Ί " print " Ί Ί Ί ΘΝΝΝΝΝΌ Ί Ί ΘΝΌ ΘΝΌ Ί Ί Ί Ί ΘΝΝΝΝΝΝ» Ί ΘΝΝΝΝΝΝ» " print " Ί Ί ΘΝΝΝΝΝΝΝΝΝΌ ΘΝΝΝΝΝΝΝΝΝΌ ΘΝΌ ΘΝΝΝΝΝΝΝΝΌ ΘΝΝΝΝΝΝΝΝΌ " print " Ί ΘΝΝΝΝΝΝ» TM " print " ΘΝΝΝΝΝΝΝΝΌ Scientific Simulations Software" PRINT print TAB(31)"E L E C T R O N" ' ON ERROR GOTO 10000 ' This is for the hercules monochrome card problem DEFINT I,J,K,L,N I=0:J=0:K=0 ' General counters NP=2 ' Number of Particles DX=0 ' Delta X DY=0 ' Delta Y PI=3.14159 PH=3.14159/2 'Pi/2 P2=2*3.14159 '2 Pi R=0 ' Distance (Particle 1 to Particle 2) 'physical constants DT=.08' Time Increment in arbitrary units RP=.6' Multiple for Proton and Electron radii : DA=0 ' Theta - Hit Angle For Blocking function HA=0 ' Hit Angle X/Y HAP=O ' Half Angle x/y plane for Part. (J) as viewed from Part. (I) TH=0 ' Angles Theta (x/y) part. I to part. J THHA=0 'TH-HA ' Speed (V/C) of fictitious particles = speed of light ESC$=CHR$(27) Z$="" 'Keyboard input SF=0 ' Scale Factor SPC$=CHR$(32) 40 DEFSTR A RANDOMIZE TIMER C1=1E+4 'Multiple for collision sound pitch C2=1E-4 'used in speed calculations SND=1 ' Sound ON/OFF label 0 = OFF 1 = ON IZ=0 ' Delay counter DIM MR1(NP),MR2(NP,NP) DIM X(NP),Y(NP),XO(NP),YO(NP),VX(NP),VY(NP) DIM MT(NP),MD(NP) DIM M(2),Q(NP),R(NP) DIM VXO(NP),VYO(NP),DV(NP) 'for collison sound pitch DELAY!=100 ' dummy value DELMIN!=1 'DELAY! Minimum DELMAX!=25000 'DELAY! Maximum IDEL=0 GOSUB 3200 'Calculate operational delay IDEL Q$=CHR$(34) 'quotation mark 50 CLS:PRINT PRINT TAB(31) "E L E C T R O N" PRINT PRINT TAB(20) "Microscopic Electrodynamic Interactions" PRINT PRINT PRINT TAB(20)"Copyright (C) 1992, Robert S. Fritzius" PRINT TAB(29)"All rights reserved. PRINT 'PRINT TAB(4)"Portions of run time module are Copyrighted by Microsoft Corp 1981-1987." PRINT PRINT:PRINT:PRINT PRINT TAB(33)"Produced by" PRINT TAB(35)"Low-Tec" PRINT TAB(30) "305 Hillside Drive" PRINT TAB(29) "Starkville, MS 39759" PRINT TAB(29)"Updated 24 May 2005" PRINT PRINT LOCATE 24,1:PRINT TAB(20)"I=Info S=Simulations ESC=Exit Program"; 165 z$=inkey$:if z$="" then 165 if z$="I" or z$="i" then gosub 9000:goto 50 if z$="S" or z$="s" then 180 if z$=ESC$ then cls:end 180 IOS=0 ' X coordinate on screen JOS=0 ' Y coordinate on screen SE=0 ' Speed of electron VO=0 ' Initial speed of electron X=0 ' Plotter Value of XU (Screen Units) Y=0 ' Plotter Value of YU (Screen Units) IXO=0 ' Old value of X JYO=0 ' Old value of Y NSP=0 ' Number of Speed Points ONSP=0 ' Old NSP SH=20 ' Scale Horizontal SV=-8 ' Scale Vertical (Should be -8.333) BL$=STRING$(78," ") Q(1)=-1:Q(2)=+1 'references common to both graphs ILES=30 ' Left Edge Screen IRES=610 ' Right Edge Screen 'Top Graph (X,Y plot) references ICTG=320 ' Horizontal Center Top Graph IXG=0 ' JTTG=10 ' Top Edge Top Graph JBTG=94 ' Bottom Edge Top Graph JCTG=(JBTG-JTTG)/2+JTTG ' Vertical Center Top Graph 'Bottom Graph (speed profile) references JTBG=105 ' Top Edge Bottom Graph JBBG=175 ' Bottom Edge Bottom Graph Speed Y ref IME=1 ' Mass of Electron MP=1837 ' Mass of Proton MREZ=137 ' Mass ratio Electron/Ritz Particle MZ=IME/MREZ ' Mass of Ritz Particle JYG=0 ' SCA=0 ' Scattering Angle AU$=CHR$(0)+CHR$(72) ' Up Arrow AD$=CHR$(0)+CHR$(80) ' Down Arrow AL$=CHR$(0)+CHR$(75) ' Left Arrow AR$=CHR$(0)+CHR$(77) ' Right Arrow F1$=CHR$(0)+CHR$(59) ' F1 Key F2$=CHR$(0)+CHR$(60) ' F2 Key F3$=CHR$(0)+CHR$(61) ' F3 Key F4$=CHR$(0)+CHR$(62) ' F4 Key F5$=CHR$(0)+CHR$(63) ' F5 Key F9$=CHR$(0)+CHR$(67) ' F9 Key : DIM VN(15) 'This is used in initial setup but not during runs INIT=1 ' Flag for initial screen special fucntions 185 PART2$="Proton" ' This is the initial point for original setup IPART2=1 SFTG=1 ' Scale Factor Top Graph R=2 MVX=0 ' summation of momentum in x direction MVY=0 ' summation of momentum in y direction 780 XE=-10:YE=2 ' Init val of X and Y of electron 1 (Screen Units) 810 XP=0:YP=0 840 VXE=.8 850 VYE=0 870 VXP=0:VYP=0 VN=0 'New Variable 890 VN( 1)=XE: VN( 2)=XP 900 VN( 3)=YE: VN( 4)=YP 930 VN( 5)=VXE:VN( 6)=VXP 935 VN( 7)=VYE:VN( 8)=VYP 940 WI$="" ' Which Item string 945 WI%=0 ' Which Item integer 950 CLS:PRINT PRINT "The present parameters are:" PRINT 970 ON IPART2 GOTO 971,972,973 971 LABEL2$="PROTON-Positron-Electron":goto 975 972 LABEL2$="Proton-POSITRON-Electron":goto 975 973 LABEL2$="Proton-Positron-ELECTRON" IF ABS(VN(5))<.0001 THEN VN(5)=.0001 'shouldn't be zero 975 ON INIT GOTO 1215,980,980 ' bypass this screen first time 980 LOCATE 4,1 PRINT " PARTICLE-1=ELECTRON PARTICLE-2 " PRINT USING "Initial X (a) ###.### X (b) ###.### ";VN( 1);VN( 2) PRINT USING "Initial Y (c) ###.### Y (d) ###.### ";VN( 3);VN( 4) PRINT USING "Initial VX (e) ##.#### C VX (f) ##.#### x C ";VN( 5);VN( 6) PRINT USING "Initial VY (g) ##.#### C VY (h) ##.#### x C ";VN( 7);VN( 8) PRINT USING "Particle-2 (i) \ \" ;LABEL2$ PRINT " (j) Restore demo initial conditions" PRINT " (k) Info " 'goto from 1080 PRINT " ESC Return (to exit)" 1100 LOCATE 17,1:PRINT BL$; LOCATE 18,1:PRINT BL$; LOCATE 17,1:PRINT "Which variable to change, [ENTER] to run"; 1105 WI$=INKEY$:IF WI$="" THEN 1105 IF WI$=ESC$ THEN 50 WI%=ASC(WI$) IF WI%=13 THEN 1215 ' was depressed - run simulation IF WI%<64 OR WI%>122 THEN 1105 'Outside usable range IF WI%>96 AND WI%<123 THEN WI%=WI%-32 'Make upper case WI%=WI%-64 ' Downshift IF WI%=9 THEN GOSUB 7200:GOTO 970 ' (i) Toggle particles IF WI%=10 THEN INIT=3:GOTO 185 ' (j) Restore intitial conditions IF WI%=11 THEN GOSUB 9000:GOTO 950 ' (k) Have to clear screen IF WI%>11 THEN 970 LCWI$=CHR$(WI%+96) 'for screen display of selected item 1120 LOCATE 17,1:PRINT BL$ LOCATE 17,1:PRINT " New value for ("LCWI$") "; INPUT VN$:IF VN$="" THEN 1100 VN=VAL(VN$) ON WI% GOTO 1131,1132,1133,1134,1135,1136,1137,1138 1131 VN(1)=VN:GOTO 970 1132 VN(2)=VN:GOTO 970 1133 VN(3)=VN:GOTO 970 1134 VN(4)=VN:GOTO 970 1135 IF VN^2 + VN(7)^2 <1 THEN VN(5)=VN:GOTO 970 GOSUB 5000:GOTO 970 1136 IF VN^2 + VN(8)^2 <1 THEN VN(6)=VN:GOTO 970 GOSUB 5000:GOTO 970 1137 IF VN^2 + VN(5)^2 <1 THEN VN(7)=VN:GOTO 970 GOSUB 5000:GOTO 970 1138 IF VN^2 + VN(6)^2 <1 THEN VN(8)=VN:GOTO 970 GOSUB 5000:GOTO 970 1165 'IF ABS(VN)<=1 THEN VN(WI%)=VN 1200 'GOTO 970 1210 : 1215 CLS:SCREEN 2 'goto point 1217 SF=SFTG ' Scale Factor 1220 IXG=ICTG ' Horizontal Center 1225 JYG=JCTG ' Vertical Center 1238 FOR I= 1 TO 2: X(I- 0)=VN(I):NEXT I 1240 FOR I= 3 TO 4: Y(I- 2)=VN(I):NEXT I 1250 FOR I= 5 TO 6:VX(I- 4)=VN(I):NEXT I 1260 FOR I= 7 TO 8:VY(I- 6)=VN(I):NEXT I 1270 FOR I=1 TO 2:XO(I)=X(I):YO(I)=Y(I):NEXT I 1271 IF VX(1)=0 AND VY(1)=0 THEN VO=0:GOTO 1275 1272 VO=SQR(VX(1)^2+VY(1)^2)' Initial speed (v/c) C=1 1275 'Calculate starting angle for particle 1 IF VX(1)=0 AND VY(1)=0 THEN STRTANG=999:GOTO 1280 IF VX(1)=0 AND VY(1)<>0 THEN STRTANG=PI-SGN(VY(1))*PH:GOTO 1276 STRTANG=ATN(VY(1)/VX(1)) 1276 IF VX(1)<0 THEN STRTANG=PI+STRTANG:GOTO 1280 ' 2nd & 3rd quadrant corrs IF VX(1)>0 AND VY(1)<0 THEN STRTANG=P2+STRTANG ' 4th quadrant corr 1280 NSP=0:ONSP=0 1310 CLS:PRINT TAB(21) "MICROSCOPIC ELECTRODYNAMIC INTERACTIONS "; 'Draw left edge for for X/Y graph DRAW "BM"+STR$(ILES)+","+STR$(JBTG) DRAW "U"+STR$(JBTG-JTTG) 'Draw top edge X/Y graph J=0 FOR I=0 TO IRES-ILES STEP 2 IF J=0 THEN DRAW "C1" ELSE DRAW "C0" DRAW "R2":J=J+1:IF J=2 THEN J=0 NEXT I:DRAW "C1" 'Draw right edge X/Y graph DRAW "D"+STR$(JBTG-JTTG) 'Draw bottom edge X/Y graph J=0 1346 FOR I=0 TO IRES-ILES STEP 2 IF J=0 THEN DRAW "C1" ELSE DRAW "C0" DRAW "L2":J=J+1:IF J=2 THEN J=0 NEXT I:DRAW "C1" GOSUB 4000 ' print scale factor LOCATE 3,67:PRINT "X/Y Plot" 'Draw Y axis top graph DRAW "BM"+STR$(ICTG)+","+STR$(JTTG) DRAW "M" +STR$(ICTG)+","+STR$(JBTG) 'Draw X-axis top graph DRAW "BM"+STR$(ILES)+","+STR$(JCTG) J=0 FOR I=0 TO IRES-ILES STEP 2 IF J=0 THEN DRAW "C1" ELSE DRAW "C0" DRAW "R2":J=J+1:IF J=2 THEN J=0 NEXT I:DRAW "C1" LOCATE 3,42:PRINT "+Y"; LOCATE 6,75:PRINT "+X"; 1351 LOCATE 13,05:PRINT "Space Bar=PAUSE/Run ESC=Setup"; 'Draw scale at sides of x/y plot FOR X=ILES+2 TO IRES-1 STEP (IRES-ILES-3) FOR Y=JCTG-5*SV TO JCTG+5*SV STEP SV CIRCLE (X,Y),1 NEXT Y NEXT X 'Draw scale at top and bottom of x/y plot FOR Y=JTTG+1 TO JBTG-1 STEP (JBTG-JTTG-2) FOR X=ICTG-14*SH TO ICTG+14*SH STEP SH CIRCLE (X,Y),1 NEXT X NEXT Y ON INIT GOTO 1355,1359,1359 'This labels the particles up close, first time 1355 LOCATE 6,08:PRINT "Electron"; LOCATE 8,34:PRINT PART2$; GOTO 1360 1359 locate 3,8:print using "Electron-\ \";part2$; 1360 'Draw outline of lower box for speed profile 1365 DRAW "BM"+STR$(ILES)+","+STR$(JBBG) 1372 DRAW "U70":J=0 1374 FOR I=0 TO IRES-ILES STEP 2 1376 IF J=0 THEN DRAW "C1" ELSE DRAW "C0" 1378 DRAW "R2":J=J+1:IF J=2 THEN J=0 1380 NEXT I:DRAW "C1" 1382 DRAW "D70":J=0 1384 FOR I=0 TO IRES-ILES STEP 2 1386 IF J=0 THEN DRAW "C1" ELSE DRAW "C0" 1388 DRAW "L2":J=J+1:IF J=2 THEN J=0 1390 NEXT I:DRAW "C1" 1410 'Fill in V/C speed labels ' LOCATE 15,44:PRINT "Electron Speed (v/c) versus Time"; LOCATE 14,1:PRINT "1.0"; LOCATE 18,1:PRINT "0.5"; LOCATE 22,1:PRINT "0.0"; LOCATE 15,79:PRINT "S"; LOCATE 16,79:PRINT "p"; LOCATE 17,79:PRINT "e"; LOCATE 18,79:PRINT "e"; LOCATE 19,79:PRINT "d"; LOCATE 21,78:PRINT "v/c"; 1427 GOSUB 3700 ' Print time 1430 LOCATE 24,1:PRINT " F1=Slower F2=Faster F3=Shrink F4=Magnify F9=Erase"; 1425 LOCATE 24,50: IF SND=1 THEN PRINT "F5=Sound ON/off"; 'see sub7000 IF SND=0 THEN PRINT "F5=Sound on/OFF"; R(1)=1 'graphed radius of electron 1450 ON IPART2 GOTO 1451,1452,1453 1451 M(2)=MP: Q(2)=+1:R(2)=3:GOTO 1455 1452 M(2)=IME: Q(2)=+1:R(2)=1:GOTO 1455 1453 M(2)=IME: Q(2)=-1:r(2)=1 1455 'Particle 1 set-up 1460 I=1 ' Electron only 1465 M(1)=IME 1470 MD(I)=IME-MZ:MT(I)=IME+MZ 1480 MR1(I)=MD(I)/MT(I) 1490 FOR J=1 TO NP:MR2(I,J)=2*Q(I)*Q(J)*MZ/MT(I):NEXT J 1500 : 1502 'Particle 2 set-up 1510 I=2 ' Proton/Positron/Electron (Mass Nucleus = MP) 1520 MD(I)=M(2)-MZ:MT(I)=M(2)+MZ 1530 MR1(I)=MD(I)/MT(I) 1540 FOR J=1 TO NP:MR2(I,J)=2*Q(I)*Q(J)*MZ/MT(I):NEXT J 1550 : 1560 REM Establishing initial particle Positions and velocities 1562 FOR I=1 TO 2 IXS =INT(SH*SF*X(I)+IXG) JYS =INT(SV*SF*Y(I)+JYG) IF I=2 AND IPART2=1 THEN CIRCLE (IXS,JYS),SF*R(I)*4:GOTO 1570 CIRCLE (IXS,JYS),R(I)*4 1570 NEXT I GOSUB 2500 ' Calculate and display total momentum INIT=2 1575 Z$=INKEY$:IF Z$="" THEN 1575 IF Z$=ESC$ THEN 950 IF Z$=F5$ THEN GOSUB 7000:GOTO 1575 IF Z$<>SPC$ THEN 1575 LOCATE 10,6:PRINT " "; 'erase MVx LOCATE 11,6:PRINT " "; 'erase MVy LOCATE 13,05:PRINT "Space Bar=Pause/RUN"; 1580 ' -------------START OF LOOP IS 1590 ------------- 1590 REM Starting point for each interation - Lotta GOTO's to here IHIT1=0:IHIT2=0 1600 FOR I=1 TO NP ' Particle 1 = electron 1606 VXO(I)=VX(I) 1607 VYO(I)=VY(I) 1610 FOR J=1 TO NP ' Particle 2 = Proton/Positron 1620 IF I=J THEN 1880 ' No self forces 1630 DX=X(I)-X(J):DY=Y(I)-Y(J) 1632 IF DX=0 AND DY=0 THEN R=0:GOTO 1640 1635 R=SQR(DX^2+DY^2) ' distance between particles 1640 IF R0 AND DY<0 THEN TH=P2+TH ' 4th quadrant corr 1740 IF IPART2<>3 THEN 1745 'Skip electron-electron reversal 1742 IF TH>=PI THEN TH=TH-PI:GOTO 1745 1743 IF TH0 THEN DA=P2-THHA:GOTO 1800 1780 DA=P2+THHA 1800 HAP=ATN(RP/R) ' Half Angle of Part. J as viewed from Part. I 1810 : 1820 REM Generate elastic collisions 1830 IF DA>HAP THEN GOSUB 2420:GOTO 1880 ' Missed! 1840 IF I=1 THEN IHIT1=1:GOTO 1860 1842 IF I=2 THEN IHIT2=1 1860 ON IPART2 GOTO 1862,1862,1872 1862 'This is for external impulses to unlike charges 1864 VX(I)=VX(I)*MR1(I)+MR2(I,J)*DX/R ' DX/R = COS(TH) VP=1 1866 VY(I)=VY(I)*MR1(I)+MR2(I,J)*DY/R ' DY/R = SIN(TH) VP=1 1868 GOTO 1880 1872 'This is for electron-electron internal repulsion 1873 'it approximates C+V 'hammer' repulsion effect 1874 VX(I)=VX(I)*MR1(I)+MR2(I,J)*(DX/R+VX(J)) ' DX/R = COS(TH) 1876 VY(I)=VY(I)*MR1(I)+MR2(I,J)*(DY/R+VY(J)) ' DY/R = SIN(TH) 1880 NEXT J 1881 IF VX(I)=0 AND VXO(I)=0 THEN DV(I)=0:GOTO 1885 1882 DV(I)=C1*SQR((VX(I)-VXO(I))^2+(VY(I)-VYO(I))^2) 1885 GOSUB 3000 ' DELAY! 1890 NEXT I 1895 'Update X,Y coordinates of both particles 1900 FOR I=1 TO NP 1910 X(I)=X(I)+VX(I)*DT 1920 Y(I)=Y(I)+VY(I)*DT 1940 GOSUB 2240 ' Plot X,Y 1950 NEXT I 1960 NSP=NSP+1 GOSUB 3700 'Print time "NSP" IF VX(1)=0 AND VY(1)=0 THEN SE=0:GOTO 1980 SE=SQR(VX(1)^2+VY(1)^2) 1980 IX=INT(.5*(NSP-ONSP)+ILES):JY=INT(-70*SE+JBBG) IF NSP=ONSP+1 THEN IXO=IX:JYO=JY IF JYOIRES THEN 2010 IF JY< JTBG THEN 2010 IF IX> IRES THEN 2010 DRAW "BM"+STR$(IXO)+","+STR$(JYO) DRAW "M"+STR$(IX)+","+STR$(JY) 2010 IXO=IX:JYO=JY Z$=INKEY$:IF Z$="" THEN 1590 IF Z$=ESC$ THEN 950 IF Z$=AU$ THEN JYG=JYG-20:GOTO 1590 IF Z$=AD$ THEN JYG=JYG+20:GOTO 1590 IF Z$=AL$ THEN IXG=IXG-50:GOTO 1590 IF Z$=AR$ THEN IXG=IXG+50:GOTO 1590 IF Z$=F1$ AND DELAY!< 0.80*DELMAX! THEN GOSUB 3500:GOTO 1590 'slower IF Z$=F2$ AND DELAY!> 1.25*DELMIN! THEN GOSUB 3600:GOTO 1590 'faster IF Z$=F3$ THEN SF=SF/2:GOSUB 4000:GOTO 1590 'shrink IF Z$=F4$ THEN SF=SF*2:GOSUB 4000:GOTO 1590 'expand IF Z$=F5$ THEN GOSUB 7000:GOTO 1590 IF Z$=F9$ THEN ONSP=NSP:IXO=ILES:GOTO 1310 ' Erase current graph & continue IF Z$<>" " THEN 2170 GOSUB 2500 'calculate and display total x and y momenta 'calculate and display dV/V IF SE=0 THEN 2140 IF VX(1)=0 AND VY(1)<>0 THEN FINANG=PI-SGN(VY(1))*PH:GOTO 2133 FINANG=ATN(VY(1)/VX(1)) 2133 IF VX(1)<0 THEN FINANG=PI+FINANG:GOTO 2134 ' 2nd & 3rd quadrant corrs IF VX(1)>0 AND VY(1)<0 THEN FINANG=P2+FINANG ' 4th quadrant corr 2134 IF STRTANG=999 THEN GOTO 2140 ' BYPASS SCATTERING ANGLE IF STRTANGPI THEN SCA=FINANG-(P2+STRTANG):GOTO 2136 SCA=FINANG-STRTANG 2136 LOCATE 13,43:PRINT USING "Scat Ang = ###.### rad ####.## deg";SCA;SCA*57.3 2140 LOCATE 23,58:PRINT USING "dV/V =#####.### ";(SE-VO)/VO; LOCATE 13,05:PRINT "Space Bar=PAUSE/Run"; 2145 Z$=INKEY$:IF Z$="" THEN 2145 LOCATE 13,05:PRINT "Space Bar=Pause/RUN"; 2150 IF Z$=ESC$ THEN CLS:GOTO 950 LOCATE 10,6 :PRINT " "; 'tot momentum LOCATE 11,6 :PRINT " "; 'tot momentum LOCATE 13,53:PRINT " "; ' Scat Angle LOCATE 23,64:PRINT " "; ' dV/V 2170 GOTO 1590 2240 REM plot X,Y on screen in graphics format 2250 IOS=INT(SH*SF*XO(I)+IXG) 2260 JOS=INT(SV*SF*YO(I)+JYG) 2310 IF IOS IRES OR JOS> JBTG THEN 2390 2330 IF IXS IRES OR JYS >JBTG THEN 2390 2350 DRAW "BM"+STR$(IOS)+","+STR$(JOS) 2360 DRAW "M" +STR$(IXS)+","+STR$(JYS) IF IHIT1=1 AND I=1 THEN CIRCLE (IOS,JOS),R(1)*4:GOTO 2390 'Electron 2370 ON IPART2 GOTO 2371,2372,2372 ' Only Proton for bigger image 2371 IF IHIT2=1 AND I=2 THEN CIRCLE (IOS,JOS),SF*R(2)*4:GOTO 2390 2372 IF IHIT2=1 AND I=2 THEN CIRCLE (IOS,JOS),R(2)*4 2390 IF SND=0 THEN 2394 2391 IF IHIT1=1 AND I=1 THEN SOUND (600+DV(I)),1:IHIT1=0:GOTO 2394 2392 IF IHIT2=1 AND I=2 THEN SOUND (400+DV(I)),1:IHIT2=0 2394 XO(I)=X(I):YO(I)=Y(I) 2397 RETURN 2410 : 2420 REM Dummy calculations for constant computation timing 2430 VX(0)=VX(0)*MR1(I)+MR2(I,J)*DX/R 2440 VY(0)=VY(0)*MR1(I)+MR2(I,J)*DY/R 2460 RETURN 2500 'Calculate and display total momentum for x and y MVX=0:MVY=0 FOR K=1 TO 2 MVX=MVX+M(K)*VX(K):MVY=MVY+M(K)*VY(K) NEXT K LOCATE 10,6:PRINT USING "Tot MVx =#####.###";MVX; LOCATE 11,6:PRINT USING "Tot MVy =#####.###";MVY; RETURN 3000 REM Delay for speed of operation 3005 FOR K=1 TO 12 3010 FOR IZ=1 TO DELAY!:NEXT IZ 3015 NEXT K 3020 RETURN 3090 ' 3100 REM DELAY! for constant computation timing 3110 FOR IZ=1 TO DELAY!:NEXT IZ 3120 RETURN 3190 ' 3200 'Calculating processing delay I1=VAL(RIGHT$(TIME$,2)) DJ!=0 ' :DK!=0 X(1)=10:X(2)=5:Y(1)=20:Y(2)=15 3230 FOR I=1 TO 200 ' dummy math processing DX=X(1)-X(2):DY=Y(1)-Y(2) R=SQR(DX^2+DY^2) NEXT I DJ!=DJ!+1 I2=VAL(RIGHT$(TIME$,2)) IF I2DELMAX! THEN DELAY!=DELMAX! 3310 RETURN 3320 ' 3400 'Print delayed message on screen COLOR 25 ' light blue, flashing locate 17,25:PRINT "Calculating operational speed" COLOR 7 K=1 RETURN 3500 DELAY!=INT(1.25*DELAY!+.76) 'slow down 3505 IF DELAY!>DELMAX! THEN DELAY!=DELMAX!:RETURN 3510 'locate 1,1:print 1000-int(50*log(DELAY!)); 3520 SOUND 1000-INT(50*LOG(DELAY!)),1 3530 RETURN 3590 ' 3600 DELAY!=INT(0.8*DELAY!) ' Speed up 3610 IF DELAY!5 then PRINT "Error code ="err:goto 10090 10005 PRINT " This machine does not know how to do high-resolution graphics." PRINT PRINT " Options" PRINT PRINT "(1) Use a PC that has a CGA, VGA, or EGA card. PRINT PRINT "(2) If your PC has a Monochrome Graphics Adapter (MGA) card, run SIMCGA" PRINT " then run this program. (If you don't know what kind of card your" PRINT " machine has, try this option.) When you finish, run RMVCGA, or reset" PRINT " your PC, to remove SIMCGA." PRINT PRINT "SIMCGA, Copyright (C) 1988-1992 by Sydex, Inc., is a program which enables" PRINT "a Monochrome Graphics Adapter (MGA) to simulate a Color Graphics Adapter " PRINT "(CGA). SIMCGA will not work with a Monochrome text Display Adapter (MDA)." PRINT "SIMCGA is licensed to Low-Tec, by Sydex, as a non-supported item. Sydex " PRINT "and Low-Tec may not be held liable for damages arising from the mis-use of" PRINT "SIMCGA." 10090 LOCATE 23,20 PRINT " Press any key to exit program."; 10095 Z$=INKEY$:IF Z$="" THEN 10095 END