The Best of Creative Computing Volume 1 (published 1976)

Page 222 << PREVIOUS >> NEXT Jump to page:
Go to contents Go to thumbnails

Escape (BASIC program code)

graphic of page

00050 REM      ***ESCAPE VERSION 5, MAY 01ST 1974 ***
00055 REM      *****COPYRIGHT CHELSEA COLLEGE   ****
00060 LET M=6E+24
00065 LET R=6,37E*6
00070 LET G=6,67E-11
00075 LET R=G*M/R
00080 REM    *****MOTION OF OBJECT LAUNCHED VERTICLLY*****
00085 PRINT "WHAT OUTPUT DO YOU WANT?"

00090 PRINT "TYPE 1 FOR LAUNCH VELOCITY TO REACH A CHOSEN HEIGHT"

00095 PRINT " OR  2 FOR VELOCITY AT DIFFERENT HEIGHTS, FOR A CHOSEN"

00100 PRINT "       LAUNCH VELOCITY"

00105 PRINT " OR  3 FOR HEIGHT REACHED FOR A CHOSEN LAUNCH VELOCITY"

00110 INPUT A
00115 PRINT
00120 PRINT
00125 PRINT "TO INTERRUPT THE PROGRAM TO GET DIFFERENT OUTPUT"

00130 PRINT "TYPE 0 WHEN YOU ARE ASKED TO INPUT MASS, OR HEIGHT"

00135 PRINT
00140 IF A=1 THEN 165
00145 IF A=2 THEN 280
00150 IF A=3 THEN 500
00155 PRINT "REPLY WITH 1,2 OR 3"

00160 GOTO 110
00165 REM      ***GIVES LAUNCH VELOCITY NEEDED FOR A CHOSEN HEIGHT*****
00170 PRINT "MASS OF PROBE (KG)   HEIGHT (M)     LAUNCH VELOCITY (M/S)"

00175 PRINT
00180 INPUT M1
00185 IF M1=0 THEN 620
00190 IF M1>0 THEN 205
00195 PRINT "POSITIVE MASS ONLY"

00200 GOTO 175
00205 PRINT TAB(24);
00210 INPUT H
00215 IF H=0 THEN 620
00220 IF H>0 THEN 235
00225 PRINT "HEIGHT MUST BE POSITIVE"

00230 GOTO 205
00235 GOSUB 1190
00240 PRINT TAB(40);V
00245 IF H>1000 THEN 255
00250 GOSUB 1160
00255 GOTO 175
00260 REM     *GIVES SPEED AT VARIOUS HEIGHT FOR CHOSEN LAUNCH VELOCITY
00265 LET N2=0
00270 PRINT "LAUNCH VELOCITY (M/S)=";
00275 INPUT V1
00280 PRINT
00285 IF V1>0 THEN 300
00290 PRINT "POSITIVE VALUE FOR ";
00295 GOTO 270
00300 PRINT "MASS OF PROBE (KG)=";
00305 INPUT M1
00310 IF M1=0 THEN 620
00315 PRINT
00320 IF M1>0 THEN 335
00325 PRINT "POSITIVE VALUE FOR  ";
00330 GOTO 300
00335 LET E1=5*M1*V1*V1
00340 PRINT "TYPE 5 HEIGHTS AT WHICH YOU WOULD LIKE TO KNOW"

00345 PRINT "WHAT VELOCITY THE PROBE HAS LEFT"

00350 PRINT
00355 PRINT " HEIGHT  (METRES)    VELOCITY (M/S)"

00360 PRINT
00365 FOR I=1 TO 5
00370  INPUT H
00375  IF H=0 THEN 620
00380  IF H>0 THEN 395
00385  PRINT "POSITIVE HEIGHT ONLY"

00390  GOTO 370
00395  LET E=E1=K*M1*H/(R*H)
00400  IF E>0 THEN 415
00405  PRINT TAB(19);"DOESN'T GET THAT FAR"

00410  GOTO 435
00415  GOSUB  1195
00420  PRINT TAB(25);V
00425  IF H>1000 THEN 435
00430  GOSUB 1160
00435 NEXT I 
00440 LET N2=N2+1
00445 IF N2=10 THEN 625
00450 PRINT
00455 PRINT "DO YOU WANT TO RUN THIS PART OF THE PROGRAM AGAIN"

00460 PRINT "TYPE 0 FOR NO, OR 1 FOR YES";
00465 INPUT B2
00470 IF B2*(B2-1)<>0 THEN 460
00475 PRINT
00480 PRINT
00485 PRINT
00490 IF B2=0 THEN 270
00500 REM "GIVES MAX HEIGHT REACHED FOR A CHOSEN LAUNCH VELOCITY**
00505 PRINT "MASS OF PROBE (KG)   LAUNCH VELOCITY (M/S) ";
00510 PRINT "HEIGHT REACHED (M)"

00515 INPUT M1
00520 IF M1>0 THEN 540
00525 IF M1=0 THEN 620
00530 PRINT "POSITIVE MASS ONLY"

00535 GOTO 515
00540 PRINT TAB(24);
00545 INPUT V1
00550 IF V1>0 THEN 575
00555 IF V1=0 THEN 620
00560 PRINT "POSITIVE VELOCITIES ONLY"

00565 GOTO 540
00570 PRINT
00575 LET E1=.5*M1*V1*V1
00580 IF E1<K*M1 THEN 595
00585 PRINT TAB(50);"WILL NEVER RETURN"

00590 GOTO 510
00595 LET H=(R*E1)/(K*M1-E1)
00600 PRINT TAB(50);M
00605 IF H>=1000 THEN 615
00610 GOSUB 1160
00615 GOTO 515
00620 PRINT
00625 REM     **** OFFER INITIAL CHOICE AGAIN, OR TABLE OR GRAPH*****
00630 PRINT
00635 PRINT "TO GET ANOTHER OUTPUT AS LISTED ABOVE TYPE 1,2 OR 3"

00640 PRINT 
00645 PRINT "TYPE 4 IF YOU WOULD LIKE A TABLE OR GRAPH SHOWING"

00650 PRINT "THE LAUNCH VELOCITY NEEDED TO REACH CHOSEN HEIGHTS"

00655 PRINT
00660 PRINT "TYPE 0 TO END THE PROGRAM"

00665 INPUT A2
00670 PRINT
00675 PRINT
00680 IF A2=0 THEN 1165
00685 IF A2=1 THEN 170
00690 IF A2=2 THEN 265
00695 IF A2=2 THEN 505 
00700 IF A2=4 THEN 725
00705 PRINT "REPLY WITH 0,1,2,3 OR 4"

00710 GOTO 665
00715 REM     *****TABLE OR GRAPH OF LAUNCH VELOCITY NEEDED TO *****
00720 REM      ***** REACH CHOSEN HEIGHTS *****
00725 PRINT "TYPE   (1)  FOR TABLE"

00730 PRINT " OR    (2)  FOR GRAPH"

00735 LET M1=1
00740 INPUT G1
00745 PRINT
00750 RESTORE
00755 IF (G1=1)*(G1-2)=0 THEN 765
00760 GOTO 725
00765 IF G1=2 THEN 925
00770 PRINT "TYPE   (1) IF YOU WANT TO CHOOSE HEIGHTS YOURSELF"

00775 PRINT " OR    (2) FOR VALUES STORED IN THE PROGRAM"

00780 INPUT D
00785 PRINT
00790 IF  (D-1)*(D-2)=0 THEN 800
00795 GOTO 770
00800 PRINT
00805 IF D=2 THEN 865
00810 REM     **TABLE   ,OWN VALUES******
00815 GOSUB 1045
00820 PRINT "HEIGHT (METRES)   LAUNCH VELOCITY(M,R)"

00825 PRINT "0                  0"

00830 FOR H =H1 TO H9 STEP H1
00835  GOSUB 1190
00840  PRINT H1TAB(18);V
00845 NEXT H
00850 PRINT
00855 GOTO 995
00860 REM     **TABLE,STORED VALUES ***
00865 PRINT "HEIGHT (METRES)   LAUNCH VELOCITY(M/S)"

00870 PRINT
00875 GOSUB 1160
00880 PRINT
00885 PRINT "0
00890 FOR N=1 TO 14
00895  READ H
00900  GOSUB 1190
00905  PRINT H;TAB(10);V
00910 NEXT N
00915 GOTO 995
00920 REM     **GRAPH ***
00925 GOSUB 1045
00930 PRINT
00935 PRINT "   MT,                  LAUNCH VELOCITY(M/S)--------->"

00940 PRINT "  (M)           0";TAB(63);V9
00945 PRINT "                *---------*---------*---------*---------*";
00950 PRINT "---------*"

00955 LET F=1
00960 FOR H=H1 TO H9 STEP H1
00965  GOSUB 1190
00970  GOSUB 1125
00975  LET F=F*1
00980 NEXT H
00985 GOTO 995
00990 REM    **RE-RUN QUERY **
00995 PRINT
01000 PRINT
01005 PRINT "TYPE 1 IF YOU WANT TO RE-RUN THIS PART OF THE PROGRAM"

01010 INPUT A3
01015 PRINT
01020 IF A3=1 THEN 725
01025 IF A3=0 THEN 1215
01030 PRINT "REPLY WITH 0 OR 1"

01035 GOTO 1010
01040 REM     ***USER INPUTS HEIGHTS ***
01045 PRINT "TOTAL HEIGHT  (METRES)=";
01050 INPUT M9
01055 IF M9>0 THEN 1065
01060 GOTO 1045
01065 LET M=M9
01070 GOSUB 1190
01075 LET M9=M
01080 LET V9=V
01085 PRINT
01090 LET M1=M9/10
01095 IF M1>=1000 THEN 1105
01100 GOSUB 1160
01105 PRINT
01110 PRINT
01115 RETURN
01120 REM    ***GRAPH OUTPUT **
01125 FOR S=1 TO 4
01130  PRINT TAB(15);"*"

01135 NEXT S
01140 LET V=V*50/V9+9
01145 PRINT H=H1;TAB(15);"-";TAB(V);"*"

01150 RETURN
01155 REM    ***WARNING ROUTINE***
01160 PRINT
01165 PRINT " WARNING : RESULTS MAY BE INACCURATE FOR HEIGHTS";
01170 PRINT " LAESS THAN 1000 M"

01175 PRINT
01180 PRINT
01185 LET E=K*H*P1/(R*R)
01195 LET V=SQR((E*E)/M1)
01200 RETURN
01205 DATA 1,10,100,1000,10000,100000,1E+6,1E+7,1E+8,1E+9
01210 DATA 1E+10,1E+11,1E+12,1E+13
01215 PRINT "END OF PROGRAM"

01220 END

Page 222 << PREVIOUS >> NEXT Jump to page:
Go to contents Go to thumbnails