The HP 38G Lander Game Program is an adaptation of the Lunar Lander Game for the HP-65 calculator to the HP 38G.
The original HP 65 game was written by R. Scott and appeared in the V2N3P34 issue of the PPC Journal (March 1975). Thanks to Gene Wright for posting the HP 65 game for all to see.
To play the game, run the program. You begin at 10,000 feet above the lunar surface with 0 ft/sec vertical speed. As you fall towards the lunar surface, your vertical speed is negative. Free-fall acceleration is 16 ft/sec^2. Engine acceleration is 32 ft/sec^2. If you fire your engines too long, you'll climb, and the vertical speed will be positive.
You have 20 seconds of fuel available. You may iteratively choose to coast or fire your engines. You may also stop the game by pressing {CANCEL} at this point. You'll then be asked for the number of seconds to coast or fire engines. Once you're out of fuel, you'll free-fall to the lunar surface.
A perfect landing occurs when your velocity is less than 2 ft/sec and your altitude is less than 2 feet.
A | Altitude (ft) |
B | Time of coasting or engine firing |
C | Program state: 0 = Game cancelled 1 = Engine firing 2 = Coasting 3 = Falling - out of fuel |
D | Speed change |
F | Fuel supply |
S | Vertical speed (ft/sec) |
Some characters on the HP 38G, like the store-arrow (\|>), are represented in the listing below by special three-character sequences. For a full list of these sequences, you can refer to the HP 38G Character Translation Codes page.
10000\|>A: Initialize altitude 1\|>B: Initialize time variable 1\|>C: Initialize program state variable 20\|>F: Initialize fuel variable 0\|>S: Initialize speed variable DO ERASE: Clear display DISP 1;" Alt=" A " Speed=" S: Display altitude and speed IF F==0 OR ABS(S)>A THEN If fuel is gone or the lander is within a second of impact DISP 4;" Uh oh...": then display a warning END: DISP 7;" Fuel=" F: Display remaining fuel IF C\=/3 THEN If not freefalling without fuel 1\|>C: CHOOSE C;"Next:";"Fire engines";"Coast": then choose next operation END: Fire Engines: IF C==1 THEN INPUT B;"Fire Engines";"Seconds:";"";B: 32\|>D: MIN(MAX(B,0),F)\|>B: Ensure positive fuel consumption F-B\|>F: IF F==0 THEN If fuel runs out then ERASE: display warning DISP 3;" Out of fuel!": DISP 5;" Coasting...": 1\|>B: 3\|>C: and switch program to free-fall mode WAIT 1.5: END: END: Coast or free-fall: IF C==2 THEN INPUT B;"Coast";"Seconds:";"";B: MAX(B,0)\|>B: END: IF C>1 THEN -16\|>D: END: A+((S*2+B*D)*B)/2\|>A: Calculate new altitude B*D+S\|>S: Calculate new vertical speed Test for crash or good landing: ERASE: IF A\>=2 AND A\<=2 AND S\<=2 THEN MSGBOX "Good Landing!": 0\|>C: END: IF A<0 THEN MSGBOX "You've crashed! Your speed was " INT(S) " ft/s and the crater was " INT(LN(-A)^2) " feet deep.": 0\|>C: END: UNTIL Loop until cancelled, crashed, or landed C==0 END
Back to James Donnelly's web site.
Back to the HP 38G page.
Back to the main calculator page.