LUNAR EXCURSION MODULE LANDING SIMULATOR
This program is a generic BASIC language "Lunar Lander" game. It runs correctly on the 9830 using the default system printer.

10 PRINT 
20 PRINT TAB(18),">>>  LEM SIMULATOR  <<<"
30 PRINT 
40 PRINT "FOR INSTRUCTIONS TYPE (1); ELSE TYPE (0)";
50 INPUT X
60 GOTO 310
70 LET X=0
80 PRINT 
90 PRINT "YOU ARE THE PILOT OF A LEM APPROACHING THE MOON. YOUR"
100 PRINT "AUTOPILOT HAS CRAPPED OUT AT AN ALTITUDE OF 100 MI."
110 PRINT "YOUR VELOCITY IS 1000 MPH STRAIGHT DOWN."
120 PRINT "   YOUR LEM MASSES";M;"LB DRY AND CARRIES"
130 PRINT F;"LB FUEL. YOUR ROCKET THRUST IS";J;"LB-MPH/SEC"
140 PRINT "AND BURNS";R;"LB/SEC OF FUEL. THE ACCELERATION"
150 PRINT "OF THE MOON'S GRAVITY IS 3.4 MPH/SEC (ASSUMED CONSTANT)."
160 PRINT "   YOUR HEIGHT, DOWNWARD SPEED, AND REMAINING FUEL WILL"
170 PRINT "BE DISPLAYED EVERY 60 SEC. (SIMULATED). AT THESE "
180 PRINT "INTERVALS THE SYSTEM PAUSES FOR YOU TO ENTER A 'BURN' "
190 PRINT "TIME IN SECONDS (ANYTHING FROM 0 TO 60, IN 0.2 SEC STEPS)"
200 PRINT "FIRING BEGINS IMMEDIATELY. WHEN THE SPECIFIED BURN TIME"
210 PRINT "EXPIRES, THE LEM COASTS FREELY TO THE END OF THAT MINUTE."
220 PRINT "THEN A STATUS REPORT IS ISSUED AND A NEW BURN TIME "
230 PRINT "REQUESTED."
240 PRINT "   TOUCHING THE KEYBOARD EXCEPT WHEN THE SYSTEM PRINTS (?)"
250 PRINT "TERMINATES THE PROGRAM. TO RESTART, TYPE (RUN). GOOD LUCK"
260 PRINT "AND HAPPY LANDINGS!"
270 PRINT 
280 PRINT 
290 PRINT 
300 GOTO 490
310 LET F=1600
320 REM F=WEIGHT OF FUEL (LB)
330 LET J=30000
340 REM J=THRUST (LB-MPH/SEC)
350 LET V=1000/3600
360 REM V=INITIAL DOWNWARD SPEED (MPH) 
370 LET M=1000
380 REM M=EMPTY MASS (LB)
390 LET H=-100
400 REM H= - HEIGHT (MI) 
410 LET F9=1
420 LET S=0.2
430 REM S=STEP SIZE
440 LET R=10
450 REM R=RATE OF BURNING (LBS/SEC)
460 IF X<-0.1 THEN 1290
470 IF X>0.1 THEN 70
480 REM
490 LET R4=R*S
500 PRINT TAB(7),"HEIGHT(MILES)        SPEED(MPH)     FUEL(LB)"
510 LET F3=F*0.1
520 GOTO 980
530 LET T=0
540 IF F <= F3 THEN 570
550 PRINT 
560 GOTO 580
570 PRINT "FUEL CRITICAL!"
580 PRINT "BURN";
590 INPUT T
595 PRINT T;
600 LET H3=199
610 IF T >= 0 THEN 650
620 LET T=-T
630 LET T9=-1
640 GOTO 660
650 LET T9=1
660 IF T < S THEN 880
670 IF T<60 THEN 690
680 LET T=60
690 IF T*R <= F THEN 730
700 LET T=F/R
710 PRINT "FUEL REMAINING FOR";T;" SEC ONLY"
720 LET F9=-1
730 FOR I=S TO T+5E-02 STEP S
740 LET A=(-J/(M+F)+3.4)/3600
750 LET V=V+A*S
760 IF V>0 THEN 800
770 IF H3<0 THEN 800
780 LET H3=H
790 LET T3=I
800 LET F=F-R4
810 LET H=H+V*S
820 IF T9>0 THEN 840
830 PRINT I,TAB(12);A;V;H;F
840 IF H>0 THEN 1030
850 NEXT I
860 IF T9>0 THEN 880
870 PRINT "BURN COMPLETE"
880 LET A=3.4/3600
890 IF H3>0 THEN 910
900 PRINT "WARNING! SPEED REVERSED AT";-H3;"MILES,";T3;"SEC OF BURN"
910 FOR I=T TO 60.1 STEP S
920 LET V=V+A*S
930 LET H=H+V*S
940 IF T9>0 THEN 960
950 PRINT I,TAB(12);A;V;H
960 IF H>0 THEN 1060
970 NEXT I
980 PRINT TAB(10),-H,V*3600,F;
990 IF F9>0 THEN 530
1000 LET T=S
1010 PRINT 
1020 GOTO 910
1030 PRINT 
1040 PRINT "TOUCHDOWN WITH ROCKET FIRING!";
1050 GOTO 1080
1060 PRINT 
1070 PRINT "TOUCHDOWN WITH ROCKET IDLE!";
1080 LET V=V*3600
1090 PRINT " SPEED =";V;"MPH."
1100 IF V>60 THEN 1190
1110 IF V>30 THEN 1130
1120 PRINT "CONGRATULATIONS!";
1130 PRINT " SAFE LANDING. REMAINING FUEL =";F;" LB.";
1140 PRINT 
1150 IF F>40 THEN 1180
1160 PRINT " CLOSE!"
1170 PRINT 
1180 STOP 
1190 PRINT 
1200 PRINT 
1210 PRINT "CALLING LEM...CALLING LEM...SURVEYOR 7 REPORTS"
1220 IF V>200 THEN 1250
1230 PRINT "MINOR ";
1240 GOTO 1260
1250 PRINT "MAJOR ";
1260 PRINT "SEISMIC EVENT AT YOUR LANDING SITE...CALLING LEM..."
1270 PRINT 
1280 STOP 
1290 PRINT "FOR (DEFAULT) INPUT 0"
1300 PRINT "V=(";V*3600;")";
1310 INPUT P
1320 IF P <= 0 THEN 1340
1330 LET V=P/3600
1340 PRINT "H=(";-H;")";
1350 INPUT P
1360 IF P <= 0 THEN 1380
1370 LET H=-P
1380 PRINT "J=(";J;")";
1390 INPUT P
1400 IF P <= 0 THEN 1420
1410 LET J=P
1420 PRINT "R=(";R;")";
1430 INPUT P
1440 IF P <= 0 THEN 1460
1450 LET R=P
1460 PRINT "M=(";M;")";
1470 INPUT P
1480 IF P <= 0 THEN 1500
1490 LET M=P
1500 PRINT "F=(";F;")";
1510 INPUT P
1520 IF P <= 0 THEN 1540
1530 LET F=P
1540 PRINT "S=(";S;")";
1550 INPUT P
1560 IF P <= 0 THEN 1580
1570 LET S=P
1580 GOTO 490
1590 END 

Comments to Webmaster

Click here for the Home page.
Click here for the Wanted page.

Last updated January 6, 2010