      PRINT
      PRINT
      PRINT
      PRINT
      PRINT
      PRINT
            PRINT "          L    U    N    A    R"
      PRINT 
      PRINT "                    L    A    N    D    E    R"
      PRINT
      PRINT
      PRINT TAB(25);"LUNAR LANDING SIMULATION"
      PRINT CHR$(7)
      PRINT TAB(15);"-------HOUSTON CALLING LUNAR MODULE-------"
      PRINT TAB(15);
      PRINT TAB(15);"YOU MAY SET THE FUEL RATE (K) TO ZERO OR ANY VALUE"
      PRINT TAB(15);"BETWEEN 8 AND 200 LBS PER SECOND.  A NEGATIVE FUEL"
      PRINT TAB(15);"RATE WILL ABORT THE MISSION."
      PRINT
      PRINT TAB(15);"YOU HAVE 16000 LBS OF FUEL."
      PRINT TAB(15);"ESTIMATED FREE FALL IMPACT TIME IS 120 SECONDS."
      PRINT TAB(15);"CAPSULE WEIGHT IS 32,500 LBS."
90    PRINT
      PRINT TAB(20);"FIRST RADAR CHECK COMING UP..."
      PRINT TAB(20);"BEGIN LANDING PROCEDURE" :PRINT:PRINT
      PRINT "TIME(SECS)","HEIGHT(MI)","VELOCITY(MPH)","FUEL(LBS)","FUEL RATE"
      LET L=0:LET A=120:LET V=1:LET M=32500:LET N=16500
      LET G=.001:LET Z=1.8
210      PRINT INT(L+.5),A,V*3600,M-N,"K  ";
      INPUT K
      LET T=10
230   IF K<0 THEN GO TO 590
      IF K=0 THEN GO TO 310
      IF K<8 THEN 260
      IF K<=200 THEN GO TO 310
260   PRINT TAB(9);"INVALID BURN RATE - RETRY";TAB(57);"K  ";
      INPUT K:  GO TO 230
310   IF M-N-.001 <0 THEN GO TO 410
      IF T<.001 THEN GO TO 210
      S=T
      IF N +S*K <=M THEN GO TO 350
      S=(M-N) /K
350   I0 =1
      GO TO 900
360   IF I <=0 THEN GO TO 710
      IF V <=0 THEN GO TO 380
      IF J <0 THEN GO TO 810
380   I0=1
      GO TO 600
410   REM
      PRINT
      PRINT "FUEL OUT AT " ;L;" SECS"
      S=(-V+SQR(V*V+2*A*G))/G
      V =V+G*S
      L=L+S
510   REM
      PRINT
      PRINT TAB(10);"----------- 'THE EAGLE HAS LANDED!' -----------"
      PRINT
      PRINT TAB(10);"ON THE MOON AT ";L;" SECS"
      W=3600*V
      PRINT TAB(10);"IMPACT VELOCITY OF ";W;" MPH"
      PRINT TAB(10);"FUEL LEFT "; M-N;" LBS"
	IF W>=60 THEN \
		GOSUB 1100 :\
		GOTO 590
	IF W>=25 THEN \
		WWW=INT((W/5))-4 :\
		GOSUB 5000 :\		REM ON GOSUB
		GOTO 590
	ON INT(W+.5)+1 GOSUB 2000,2100,2200,2300,2400,2500,2600, \
			     2700,2800,2900,3000,3100,3200,3300, \
			     3400,3500,3600,3700,3800,3900,4000, \
			     4100,4200,4300,4400,4400 
	GOTO 590
	PRINT "<ON> STMT ERROR"
1100	REM-----  W>=60-----
	PRINT TAB(10);"SORRY, THERE WERE NO SURVIVORS"
	PRINT TAB(10);"IN FACT, YOU BLASTED A NEW LUNAR CRATER ";
	PRINT W*.277777;" FEET DEEP!"
	RETURN
1200	REM----- 25<=W<30
	PRINT TAB(10);"UNSAFE LANDING WITH MINOR CRAFT DAMAGE"
	RETURN
1300	REM----- 30<=W<35
	PRINT TAB(10);"LANDING GEAR DAMAGED"
	RETURN
1400	REM----- 35<=W<40
	PRINT TAB(10);"DAMAGE SIGNIFICANT. UNABLE TO TAKE OFF"
	RETURN
1500	REM----- 40<=W<45
	PRINT TAB(10);"MAJOR DAMAGE.  CREW INJURED."
	RETURN
1600	REM----- 45<=W<50
	PRINT TAB(10);"IMPACT SEVERE.  CRAFT DESTROYED."
	RETURN
1700	REM----- 50<=W<55
	PRINT TAB(10);"LANDING CRAFT DISINTEGRATED ON IMPACT."
	RETURN
1800	REM----- 55<=W<60
	PRINT TAB(10);"TOTAL LOSS"
	RETURN
2000	REM----- 0<=W<.5
	PRINT CHR$(7);TAB(10);"----------------------------------------"
	PRINT TAB(10);"     P   E   R   F   E   C   T   !"
	PRINT CHR$(7);TAB(10);"----------------------------------------"
	PRINT 
	RETURN
2100	REM----- .5<=W<1.5
	PRINT TAB(10);"G R E A T       L A N D I N G"
	PRINT
	RETURN
2200	REM----- 1.5<=W<2.5
	PRINT TAB(10);"EXCELLENT LANDING, CAPTAIN"
	RETURN
2300	REM----- 2.5<=W<3.5
	PRINT TAB(10);"ONE OF THE BEST LANDINGS I'VE SEEN"
	RETURN
2400	REM----- 3.5<=W<4.5
	PRINT TAB(10);"VERY GOOD, SIR.  ALMOST THERE"
	RETURN
2500	REM----- 4.5<=W<5.5
	PRINT TAB(10);"GOOD LANDING"
	RETURN
2600	REM----- 5.5<=W<6.5
	PRINT TAB(10);"SOFT LANDING"
	RETURN
2700	REM----- 6.5<=W<7.5
	PRINT TAB(10);"SOFT LANDING BUT THE CREW IS SHAKEN"
	RETURN
2800	REM----- 7.5<=W<8.5
	PRINT TAB(10);"OK LANDING BUT HOUSTON IS COMPLAINING"
	RETURN
2900	REM----- 8.5<=W<9.5
	PRINT TAB(10);"FENDER BENDER"
	RETURN
3000	REM----- 9.5<=W<10.5
	PRINT TAB(10);"ARE YOUR HANDS SWEATING?"
	RETURN
3100	REM----- 10.5<=W<11.5
	PRINT TAB(10);"WHEW. . .  THAT WAS CLOSE!"
	RETURN
3200	REM----- 11.5<=W<12.5
	PRINT TAB(10);"GETTING BETTER"
	RETURN
3300	REM----- 12.5<=W<13.5
	PRINT TAB(10);"IMPACT VELOCITY APPROACHING SAFETY LIMITS"
	RETURN
3400	REM----- 13.5<=W<14.5
	PRINT TAB(10);"NEIL ARMSTRONG COULD DO BETTER"
	RETURN
3500	REM----- 14.5<=W<15.5
	PRINT TAB(10);"ANY FASTER AND THE PRESIDENT WON'T TELEPHONE YOU"
	RETURN
3600	REM----- 15.5<=W<16.5
	PRINT TAB(10);"HOUSTON: 'ARE YOU ALL RIGHT UP THERE?!?'"
	RETURN
3700	REM----- 16.5<=W<17.5
	PRINT TAB(10);"AT LEAST YOU MADE IT"
	RETURN
3800	REM----- 17.5<=W<18.5
	PRINT TAB(10);"WELL, THAT'S BETTER THAN THE RUSSIANS DID"
	RETURN
3900	REM----- 18.5<=W<19.5
	PRINT TAB(10);"POSSIBLE DAMAGE TO CRAFT"
	RETURN
4000	REM----- 19.5<=W<20.5
	PRINT TAB(10);"HOUSTON IS REVOKING YOUR PILOTS LICENSE"
	RETURN
4100	REM----- 20.5<=W<21.5
	PRINT TAB(10);"AFTER THAT IMPACT, THE LANDER WILL NEED AN OVERHAUL!"
	RETURN
4200	REM----- 21.5<=W<22.5
	PRINT TAB(10);"SCIENTIFIC PAYLOAD PACKAGE DAMAGED"
	RETURN
4300	REM----- 22.5<=W<23.5
	PRINT TAB(10);"EXTERNAL ANTENNA DID NOT SURVIVE THE IMPACT"
	RETURN
4400	REM----- 23.5<=W<24.5
	PRINT TAB(10);"EVA WILL REVEAL DAMAGE TO LANDING GEAR"
	RETURN
	PRINT:PRINT
590	REM
      PRINT TAB(20);"TRY AGAIN?  (Y OR N)  ";
     INPUT R$
      IF LEFT$(R$,1)="Y" THEN GO TO 90
	IF LEFT$(R$,1)<>"N" THEN \
		PRINT TAB(20);"HOUSTON: 'I DIDN'T COPY. REPEAT'" :\
		GOTO 590
      PRINT
      PRINT
      PRINT TAB(10);"THIS IS HOUSTON SIGNING OFF"
      STOP
600   L=L+S
      T=T-S
      M=M-S*K
      A=I
      V=J
      IF I0=1 THEN GO TO 310
      IF I0=3 THEN GO TO 850
710   IF S<.005 THEN GO TO 510
TEMP1=(G-Z*K/M)
TEMP=V*V+2*A*(TEMP1)
S=2*A/(V+SQR(TEMP))
      I0=2
      GO TO 900
810   W=(1-M*G/(Z*K))/2
TEMP1=(W*W+V/Z)
TEMPT=(W+SQR(TEMP1))
TEMPT2=(Z*K*(TEMPT))
S=M*V/TEMPT2+.05
      I0=3
      GO TO 900
830   IF I<=0 THEN GOTO 710
      GO TO 600
850   IF J>=0 THEN GO TO 310
      IF V<=0 THEN GO TO 310
      GO TO 810
900   Q=S*K/M
      IF Q<=0 THEN GO TO 1000
TEMP=(1/4+Q*(1/5))
TEMP1=(1/3+Q*(TEMP))
TEMP2=(1/2+Q*(TEMP1))
TEMP3=(1+Q*(TEMP2))
J=V+G*S+Z*(-Q*(TEMP3))
TEMP=(1/20 +Q*(1/30))
TEMP1=(1/6+Q*(1/12+Q*TEMP))
TEMP2=(1/2+Q*(TEMP1))
TEMP3=(Q*(TEMP2))
I=A-G*S*S/2-V*S+Z*S*(TEMP3)
930   IF I0=1 THEN GO TO 360
      IF I0=2 THEN GO TO 600
       IF I0=3 THEN GO TO 830
1000   J=V+G*S
      I=A-G*S*S/2-V*S
      GO TO 930
5000	REM-----ON GOSUB
	ON WWW GOSUB 1200,1300,1400,1500,1600,1700,1800
	RETURN
