The Museum of HP Calculators


Moon Landing Simulator for the HP-25

This program is Copyright © 1975 by Hewlett-Packard and is used here by permission. This program was originally published in "HP-25 Applications Programs".

This program is supplied without representation or warranty of any kind. Hewlett-Packard Company and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Overview

Imagine for a moment the difficulties involved in landing a rocket on the moon with a strictly limited fuel supply. You're coming down tail-first, free-falling toward a hard rock surface. You'll have to ignite your rockets to slow your descent; but if you burn too much too soon, you'll run out of fuel 100 feet up, and then you'll have nothing to look forward to but cold eternal moon dust coming faster every second. The object, clearly, is to space your burns just right so that you will alight on the moon's surface with no downward velocity.

The game starts off with the rocket descending at a velocity of 50 feet/sec from a height of 500 feet. The velocity and height are shown in a combined display as -50.0500, the height appearing to the right of the decimal point and the velocity to the left, with a negative sign on the velocity to indicate downward motion. If a velocity is ever displayed with no fractional part, for example, -15., it means that you have crashed at a speed of 15 feet/sec. In game terms, this means that you have lost; in real-life, it signifies an even less favorable outcome.

You will start the game with 120 units of fuel. You may burn as much or as little of your available fuel as you wish at each step of your descent; burns of zero are quite common. A burn of 5 units will just cancel gravity and hold your speed constant. Any burn over 5 will act to change your speed in an upward direction. You must take care, however, not to burn more fuel than you have; for if you do, no burn at all will take place, and you will free-fall to your doom! The final velocity shown will be your impact velocity (generally rather high). You may display your remaining fuel at any time by recalling R2.

Equations:

We don't want to get too specific, because that would spoil the fun of the game; but rest assured that the program is solidly based on some old friends from Newtonian physics:

x = x0+v0t + (1/2)at2
v=v0 + at
v2 = v02 + 2ax
where x, v, a, and t are distance, velocity, acceleration, and time.

Notes:

1. If you crash before running out of fuel, the crash velocity shown will be the velocity before the burn, rather than the impact velocity.

2. Use only integer values for burns. Any decimal entry will cause an error in the display for V.X.

Instructions

Step

Instructions

Input Data/Units

Keys

Output Data/Units

1

Enter program

     

2

Initialize

x

500 STO 0

500.00

   

v

50 CHS STO 1

-50.00

   

Fuel

120 STO 2

120.00

3

Display Initial V.X

 

f PRGM R/S

 -50.0500

 4

Key in burn, compute new speed and distance  

Burn

R/S

new V.X

5

Perform step 4 till you land or crash

 

 

 

6

To see remaining fuel at any time

 

RCL 2

Fuel

To display speed and distance at any time  

f PRGM R/S

V.X

To Start a new game goto step 2

 

 

 

Example

The Program

LINE    CODE    KEYS            COMMENTS
 00
 01  14 11 04   f FIX 4         Four-place display
 02     24 00   RCL 0           Form display V.X
 03        33   EEX
 04        04   4
 05        71   ÷               Divide X by 10,000
 06     24 01   RCL 1 
 07     15 41   g x<0           Is V negative?
 08     13 11   GTO 11          Yes, branch
 09        51   +               No, add V and X
 10     13 13   GTO 13 
 11        21   x<>y            V<0, add V and -X
 12        41   -
 13        74   R/S             V.X is V +/- (x/104)
 14     24 02   RCL 2           Burn B has been input
 15     14 41   f x<y           Burn > Fuel?
 16     13 34   GTO 34          Yes, prepare to crash
 17        22   roll dn         No, update A, X, V
 18  23 41 02   STO - 2         Subtract burn from fuel
 19        05   5               5 units cancels gravity
 20        41   -               Acceleration = B - 5
 21     23 03   STO 3
 22        02   2
 23        71   ÷
 24     24 00   RCL 0            
 25        51   +               
 26     24 01   RCL 1            
 27        51   +               New altitude: X = X+V+A/2
 28     23 00   STO 0
 29     15 41   g x<0           Is X below ground?
 30     13 44   GTO 44          Yes, you've crashed
 31     24 03   RCL 3           No, update V
 32  23 51 01   STO + 1         New velocity: V = V + A
 33     13 02   GTO 02          Display V.X
 34     24 01   RCL 1           All fuel gone show crash
 35     15 02   g x2                velocity as
 36     24 00   RCL 0               V = (V2 + 2gX)1/2 
 37        01   1                   where g = gravity = 5
 38        00   0
 39        61   x
 40        51   +       
 41     14 02   f sqrt
 42        32   CHS             Show crash V down
 43     23 01   STO 1
 44     24 01   RCL 1           Come here from line 30
 45  14 11 00   f FIX 0         Display integer V to
 46     13 00   GTO 00              show crash  
 47
 46
 49

Register Use

R0  x
R1  v
R2  Fuel
R3  Acceleration

Go back to the software library
Go back to the main exhibit hall