Lunar Lander - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: HP Prime Software Library (/forum-15.html) +--- Thread: Lunar Lander (/thread-7615.html) Lunar Lander - Gene222 - 01-17-2017 06:51 AM Lunar Lander Simulation game, 1 dimensional, no graphics. 9/22/21 Added LunarLander2 based on Jim Storer's 1969 FOCAL program. The lunar lander is 500 ft above the moon with a downward velocity of 50 ft/s and has 120 units of fuel. The height, velocity, and remaining fuel are displayed. The program will pause for up to 60 seconds. Enter the number of units of fuel you wish to burn during the next second, then press the Enter key. The new height, velocity and remaining fuel are displayed. The maximum amount of fuel you can burn at one time is 30 units. For more instructions, view the program INFO on the HP Prime. The program was adapted from the Rocket program in Basic Computer Games, MicroComputer Edition, 1978 by David H. Ahl. The Rocket program was written by Eric Peters at Digital Equipment Corporation. A copy of the program is shown below. The Rocket program is a simpler version of the very first lunar lander program that was written by Jim Storer in 1969, while he was a high school student. ADDED 11/9/18. Rocket Program Code from Basic Computer Games, MicroComputer Edition. Code: ```10 PRINT TAB(30); "ROCKET" 20 PRINT TAB(15); "CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY" 30 PRINT: PRINT: PRINT 70 PRINT "LUNAR LANDING SIMULATION" 80 PRINT "----- ------- ----------": PRINT 100 INPUT "DO YOU WANT INSTRUCTIONS (YES OR NO)"; A\$ 110 IF A\$ = "NO" THEN 390 160 PRINT 200 PRINT "YOU ARE LANDING ON THE MOON AND AND HAVE TAKEN OVER MANUAL" 210 PRINT "CONTROL 1000 FEET ABOVE A GOOD LANDING SPOT. YOU HAVE A DOWN-" 220 PRINT "WARD VELOCITY OF 50 FEET/SEC. 150 UNITS OF FUEL REMAIN." 225 PRINT 230 PRINT "HERE ARE THE RULES THAT GOVERN YOUR APOLLO SPACE-CRAFT:": PRINT 240 PRINT "(1) AFTER EACH SECOND THE HEIGHT, VELOCITY, AND REMAINING FUEL" 250 PRINT "    WILL BE REPORTED VIA DIGBY YOUR ON-BOARD COMPUTER." 260 PRINT "(2) AFTER THE REPORT A '?' WILL APPEAR. ENTER THE NUMBER" 270 PRINT "    OF UNITS OF FUEL YOU WISH TO BURN DURING THE NEXT" 280 PRINT "    SECOND. EACH UNIT OF FUEL WILL SLOW YOUR DESCENT BY" 290 PRINT "    1 FOOT/SEC." 310 PRINT "(3) THE MAXIMUM THRUST OF YOUR ENGINE IS 30 FEET/SEC/SEC" 320 PRINT "    OR 30 UNITS OF FUEL PER SECOND." 330 PRINT "(4) WHEN YOU CONTACT THE LUNAR SURFACE. YOUR DESCENT ENGINE" 340 PRINT "    WILL AUTOMATICALLY SHUT DOWN AND YOU WILL BE GIVEN A" 350 PRINT "    REPORT OF YOUR LANDING SPEED AND REMAINING FUEL." 360 PRINT "(5) IF YOU RUN OUT OF FUEL THE '?' WILL NO LONGER APPEAR" 370 PRINT "    BUT YOUR SECOND BY SECOND REPORT WILL CONTINUE UNTIL" 380 PRINT "    YOU CONTACT THE LUNAR SURFACE.": PRINT 390 PRINT "BEGINNING LANDING PROCEDURE..........": PRINT 400 PRINT "G O O D  L U C K ! ! !" 420 PRINT: PRINT 430 PRINT "SEC  FEET      SPEED     FUEL     PLOT OF DISTANCE" 450 PRINT 455 T = 0: H = 1000: V = 50: F = 150 490 PRINT T; TAB(6); H; TAB(16); V; TAB(26); F; TAB(35); "I"; TAB(H / 15); "*" 500 INPUT B 510 IF B < 0 THEN 650 520 IF B > 30 THEN B = 30 530 IF B > F THEN B = F 540 V1 = V - B + 5 560 F = F - B 570 H = H - .5 * (V + V1) 580 IF H <= 0 THEN 670 590 T = T + 1 600 V = V1 610 IF F > 0 THEN 490 615 IF B = 0 THEN 640 620 PRINT "**** OUT OF FUEL ****" 640 PRINT T; TAB(4); H; TAB(12); V; TAB(20); F; TAB(29); "I"; TAB(H / 12 + 29); "*" 650 B = 0 660 GOTO 540 670 PRINT "***** CONTACT *****" 680 H = H + .5 * (V1 + V) 690 IF B = 5 THEN 720 700 D = (-V + SQR(V * V + H * (10 - 2 * B))) / (5 - B) 710 GOTO 730 720 D = H / V 730 V1 = V + (5 - B) * D 760 PRINT "TOUCHDOWN AT"; T + D; "SECONDS." 770 PRINT "LANDING VELOCITY="; V1; "FEET/SEC." 780 PRINT F; "UNITS OF FUEL REMAINING." 790 IF V1 <> 0 THEN 810 800 PRINT "CONGRATULATIONS! A PERFECT LANDING!!" 805 PRINT "YOUR LICENSE WILL BE RENEWED.......LATER." 810 IF ABS(V1) < 2 THEN 840 820 PRINT "***** SORRY, BUT YOU BLEW IT!!!!" 830 PRINT "APPROPRIATE CONDOLENCES WILL BE SENT TO YOUR NEXT OF KIN." 840 PRINT: PRINT: PRINT 850 INPUT "ANOTHER MISSION"; A\$ 860 IF A\$ = "YES" THEN 390 870 PRINT: PRINT "CONTROL OUT.": PRINT 999 END``` [attachment=4370] RE: Lunar Lander - StephenG1CMZ - 01-17-2017 03:29 PM When trying to display the pdf, Android says attachment.php is of the wrong format. Update: Android 4.4.4 and Android 5.0.2, both using the default pdf viewer which normally seems to display the file before downloading it. RE: Lunar Lander - Gene222 - 01-17-2017 07:30 PM Quote:When trying to display the pdf, Android says attachment.php is of the wrong format. The original program in PDF format opens on my computer, but I am using acrobat standard 6, which is pretty old. EDIT 11/9/18. The original program code was added to the first post and the pdf attachment of the original program code was removed. RE: Lunar Lander - Didier Lachieze - 01-17-2017 07:49 PM (01-17-2017 03:29 PM)StephenG1CMZ Wrote:  When trying to display the pdf, Android says attachment.php is of the wrong format. It works for me on Android 6, the pdf is downloaded and I can then open it with Acrobat. @Gene222: thanks for this program and the documents ! RE: Lunar Lander - ggauny@live.fr - 03-07-2017 12:31 PM Hi, Nice work ! I only change all "208" in print with "218" to have good alignement with large format. BTW one solution is : ENTER 5 times 0 fuel and ENTER 5 times 20 units of fuel. Landing good without you dead ! (In HP65 Key Note- V2N2) Others solutions ? RE: Lunar Lander - David Hayden - 03-07-2017 09:58 PM I wrote an article in Datafile about bugs in the Lunar Lander programs. For anyone who's interested it's attached. Dave RE: Lunar Lander - ggauny@live.fr - 03-08-2017 09:51 AM Thanks David. RE: Lunar Lander - jjohnson873 - 09-09-2021 08:39 PM David....I always enjoy reading your documents on HP firmware. Thank you for a nice explanation of the Lunar Lander bugs and how they propagated from the HP-67 to the HP-29. Interesting speculation on why the HP-25 had a bug due to memory constraints. You didn't mention if the HP-41C Usersâ€™ Library Solutions Games Pac, planet "Lander" program had any similarities or differences to your corrected HP Lunar Lander program. Also, I was curious when you wrote this paper? I didn't see a date on your paper......or I missed the date . ~ Jim J. ~ RE: Lunar Lander - Gene222 - 09-23-2021 02:24 AM Added LunarLander2 based on Jim Storer's 1969 FOCAL program. Program include a fix of David Hayden's bounce bug.