The Museum of HP Calculators


Moon Landing Simulator for the HP 9100

This program was adapted by Dave Hicks from the "HP-25 Applications Programs" book Copyright © 1975 by Hewlett-Packard and is used here by permission.

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, height and fuel are shown in the HP-9100's three line display as

-50      (Velocity 50 ft/sec downward)
500      (Altitude 500 feet)
120      (Fuel left: 120 units - this line changes to 0 after 1 second.)

The velocity is shown with a negative sign to indicate downward motion. The Fuel is displayed for just a second and then changes to zero. This lets you perform a 0 fuel burn by simply pressing the CONTINUE button (CONT on the HP-9100B.) (Otherwise the default burn would be all your fuel which is usually not what you want.)

A perfect landing shows as three zeros. A display like:

-velocity
0
-999999 

means you have landed (or crashed) with non-zero velocity. In real life, you'd probably survive if the velocity is around -1 but at say -10, you wouldn't be coming back.

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). If the fuel flashes by and you forget it, you may recall it by pressing f.

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. Unlike the handheld versions, it's OK to burn fractional units of fuel. This is because this program doesn't have to combine the multiple numbers into a one line display.

Instructions

Step

Instructions

Input Data/Units

Keys

Output Data/Units

1

Enter program

     

2

Initialize

END CONTINUE

-50/500/120

3

Key in burn, compute new speed and distance. (For burn of zero, just press CONTINUE.)

Burn
(if non-zero)

CONTINUE

new Vel/Alt/Fuel

5

Perform step 3 till you land or crash

 

 

 

6

To see remaining fuel after it has been cleared.

 

f

Vel/Alt/Fuel

To Start a new game goto step 2

 

 

 

Example

The following outputs are shown with the decimal wheel set to zero but that's not a requirement of the program

END CONTINUE           -50/500/120    (the fuel units will change to zero
CONTINUE               -55/488/120     after a second)
5 CONTINUE             -55/393/115
30 CONTINUE            -30/350/85
CONTINUE               -35/318/85
CONTINUE               -40/280/85
CONTINUE               -45/238/85
CONTINUE               -50/190/85
10 CONTINUE            -45/143/75
CONTINUE               -50/95/75
10 CONTINUE            -45/48/65
25 CONTINUE            -25/13/40      Looking dangerous!
20 CONTINUE            -25/0/-999999  Crash!!!

The Program

LINE  CODE  KEY         COMMENTS
 00    05   5           Initialize
 01    00   0
 02    32   CHG SIGN
 03    23   x->()
 04    12   e           initial velocity
 05    05   5
 06    00   0
 07    00   0
 08    23   x->()
 09    17   d           initial distance
 0a    01   1
 0b    02   2
 0c    00   0
 0d    23   x->()
 10    15   f           initial fuel
 11    12   e           Set up the display
 12    27   ENTER^
 13    17   d
 14    27   ENTER^
 15    15   f
 16    57   PAUSE       Display the Vel/Altitude/Fuel for 1 sec
 17    57   PAUSE
 18    57   PAUSE
 19    57   PAUSE
 1a    57   PAUSE
 1b    57   PAUSE
 1c    57   PAUSE
 1d    57   PAUSE
 20    00   0           Replace fuel with zero
 21    41   STOP        Allow input (default is a zero burn.)
 22    27   ENTER^      Move requested burn into y
 23    15   f           Fuel in x
 24    52   IF x<y      Attempting to burn more fuel than available?
 25    04   4           Prepair to crash!
 26    11   9           
 27    30   x<>y        fuel in y, burn in x
 28    34   -           fuel left after burn
 29    40   y->()
 2a    15   f           save fuel left
 2b    27   ENTER^      burn -> y
 2c    05   5
 2d    34   -           y = burn - 5 (subtract gravity effect from burn)
 30    40   y->()
 31    13   a           acceleration = burn - 5
 32    02   2           compute new altitude
 33    35   /           y = a/2
 34    17   d           x = d, y = a/2
 35    33   +           y = d + a/2
 36    12   e           x = vel, y = d+a/2
 37    33   +           y = d + v + a/2
 38    40   y->()
 39    17   d           save new altitude
 3a    00   0
 3b    53   IF x>y      Are we now below ground?
 3c    05   5
 3d    13   a           If yes, go to crash display!
 40    13   a           x=a, y=d
 41    27   ENTER^      x=a, y=a, z=d
 42    12   e           x=vel, y=a, z=d
 43    33   +           x=vel, y=a+vel, z=d
 44    40   y->()
 45    12   e           New velocity = vel + a
 46    44   GO TO
 47    01   1
 48    01   1           Loop Around for another display
 49    12   e           x=vel; Fuel gone show crash velocity as
 4a    27   ENTER^      x=vel,y=vel;  sqrt(v^2+2gd)
 4b    36   x           y=vel^2
 4c    17   d
 4d    27   ENTER^      x=d, y=d, z=vel^2
 50    01   1
 51    00   0           x=2g (g=5)
 52    36   x           y=2gd, z=vel^2
 53    25   drop
 54    33   +           y=vel^2+2gd
 55    25   drop        y->x
 56    76   sqrt        y=sqrt(vel^2+2gd)
 57    32   CHS
 58    23   x->()
 59    12   e           Store crash velocity
 5a    12   e           Generate a hard land/crash display
 5b    27   ENTER^      vel/0/-999999
 5c    00   0           Show 0 for crash altitude because 
 5d    27   ENTER^      it's too much work to compute
 60    11   9           the crator depth
 61    11   9
 62    11   9
 63    11   9
 64    11   9
 65    11   9
 66    32   CHS         Fuel at -999999 indicates a crash    
 67    46   END                                                               

Register Use

d  Altitude (d for distance)
e  vElocity
f  Fuel
a  Acceleration

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