Post Reply 
Rocket Game - from 101 BASIC Computer Games
12-31-2018, 09:13 AM
Post: #10
RE: Rocket Game - from 101 BASIC Computer Games
Hi,

Well, I'd say the program was compressed before being published; that's why it's rather hard to read.
In a somewhat less compact version it would look more like this. (Slightly different dialect, for readability.)

Code:

10 rem ROCKET GAME
100 rem Intro:
110 PRINT "THIS IS A COMPUTER SIMULATION OF AN APOLLO LUNAR"
120 PRINT "LANDING CAPSULE, ":PRINT:PRINT
130 PRINT "THE ON-BOARD COMPUTER HAS FAILED (IT WASN'T MADE BY"
140 PRINT "DIGITAL) SO YOU HAVE TO LAND THE CAPSULE MANUALLY"
199 rem -----------------------------------------------------------
200 rem Program Loop:
299 rem -----------------------------------------------------------
300 rem Instructions:
310 PRINT
320 PRINT "SET BURN RATE OF RETRO ROCKETS TO ANY VALUE BETWEEN"
330 PRINT "0 (FREE FALL) AND 200 (MAXIMUM BURN) POUNDS PER SECOND"
340 PRINT "SET NEW BURN RATE EVERY 10 SECONDS. "
350 PRINT
360 PRINT "CAPSULE WEIGHT 32,500 LBS, FUEL WEIGHT 16,500 LBS"
370 PRINT:PRINT
371 PRINT "GOOD LUCK!!!"
380 goto 1000: Rem Game proper
499 rem -----------------------------------------------------------
500 rem Restart:
510 PRINT:PRINT:PRINT
520 PRINT "TRY AGAIN??"
521 rem This is not actually a question.
522 rem Rather, it's an order: There is no in-game way to stop.
530 GOTO 200: rem start of program loop
540 rem End of Program loop
998 rem -----------------------------------------------------------
999 rem -----------------------------------------------------------
1000 rem Game proper:
1010 L=0: Rem Time elapsed, in seconds
1020 PRINT
1021 PRINT "SEC", "MI + FT", "MPH", "LB FUEL", "BURN RATE":PRINT
1022 rem Could be made to repeat this header before it disappears.
1030 A=120: Rem Distance from Moon, in miles
1031 V=1: Rem Velocity, in miles per second
1032 M=33000: Rem Total weight, in pounds
1033 N=16500: Rem Non-fuel weight (capsule plus you), in pounds
1034 G=1E-3: rem Gravitational acceleration
1035 Z=1.8
1038 rem -----------------------------------------------------------
1039 rem Start of Game Loop:
1040 PRINT L,INT(A); INT(5280*(A-INT(A))),3600*V,M-N,
1041 INPUT K: Rem Burn Rate: Fills-in the last column of the table.
1042 T=10: Rem seconds till next input.
1059 rem -----------------------------------------------------------
1060 rem Start of Inner loop:
1070 IF M-N<0.001 THEN 2200: rem out of fuel
1071 IF T<0.001 THEN 1105: rem end of the game loop.
1072 S=T
1073 IF M <= N+S*K THEN S=(M-N)/K
1090 GOSUB 3200: rem calculate
1091 IF I<=0 THEN 1710
1092 IF V>0 and J<0 THEN 1110
1100 GOSUB 3100: rem update
1101 GOTO 1060: rem start of the inner loop
1102 rem End of inner loop
1103 rem -----------------------------------------------------------
1105 goto 1040: rem start of the game loop.
1110 rem End of Game loop.
1111 rem -----------------------------------------------------------
1999 rem -----------------------------------------------------------
2000 rem Routines
2099 rem -----------------------------------------------------------
2100 rem Endings
2199 rem -----------------------------------------------------------
2200 rem Out of Fuel:
2210 PRINT "FUEL OUT AT"L "SEC "
2211 S=(-V+SQR(V*V+2*A*G))/G
2212 V=V+G*S
2213 L=L+S
2299 rem -----------------------------------------------------------
2300 rem Arrival:
2310 W=3600*V
2311 PRINT"ON MOON AT"L"SEC - IMPACT VELOCITY" W "MPH"
2320 IF W>1.2 THEN 2330
2321 PRINT "PERFECT LANDING! (LUCKY)"
2322 GOTO 2380: rem end of arrival
2330 IF W>10 THEN 2340
2331 PRINT "GOOD LANDING (COULD BE BETTER)"
2332 GOTO 2380: rem end of arrival
2340 IF W>60 THEN 2360
2341 PRINT "CRAFT DAMAGE... YOU'RE STRANDED HERE UNTIL"
2350 PRINT "A RESCUE PARTY ARRIVES, HOPE YOU HAVE ENOUGH OXYGEN!"
2351 GOTO 2380: rem end of arrival
2360 PRINT "SORRY, BUT THERE WERE NO SURVIVORS... YOU BLEW IT!"
2370 PRINT "IN FACT, YOU BLASTED A NEW LUNAR CRATER"W*0.2777"FT DEEP"
2380 GOTO 500: rem restart
2380 rem End of arrival
2399 rem -----------------------------------------------------------
2499 rem -----------------------------------------------------------
2500 rem jumping point
2510 W=(1-M*G/(Z*K))/2
2520 S=M*V/(Z*K*(W+SQR(W*W+V/Z)))+0.05
2530 GOSUB 3200: rem calculate
2540 IF I>0 THEN 2700: rem loop 2
2550 rem Loop 1
2555 rem Once we get here, we're looping until arrival.
2560 IF S<5E-3 THEN 2300: rem arrival
2570 D=V+SQR(V*V+2*A*(G-Z*K/M)
2580 S=2*A/D
2580 GOSUB 3200: rem calculate
2590 GOSUB 3100: rem update
2600 GOTO 2550: rem Loop 1
2699 rem -----------------------------------------------------------
2700 Rem Loop 2
2710 GOSUB 3100
2720 IF J<=0 and V>0 THEN 2700: Rem loop 2
2730 GOTO 1060: rem inner loop
2998 rem -----------------------------------------------------------
2999 rem -----------------------------------------------------------
3000 rem Subroutines:
3099 rem -----------------------------------------------------------
3100 rem Update
3110 L=L+S:T=T-S:M=M-S*K:A=I:V=J:RETURN
3199 rem -----------------------------------------------------------
3200 rem Calculate
3210 Q=S*K/M:J=V+G*S+Z*(-Q-Q*Q/2-Q^3/3-Q^4/4-Q^5/5)
3220 I=A-G*S*S/2-V*S+Z*S*(Q/2+Q^2/6+Q^3/12+Q^4/20+Q^5/30):RETURN
3999 rem -----------------------------------------------------------
4000 rem Comments
4010 rem The game could be made to allow SI units, rather than Imperial.
4020 rem Could have a setting for exact old behaviour versus Digital ad-less.
4030 rem Could be modified to a lander for any vacuum atmosphere body.
Usual warnings apply.

(Doesn't immediately tell us what it does, but might make it easier to determine where to look.)

BFN,
Mysha
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Rocket Game - from 101 BASIC Computer Games - Mysha - 12-31-2018 09:13 AM



User(s) browsing this thread: 1 Guest(s)