The Museum of HP Calculators


Planet Lander for the HP-41C

This program was first published in the HP-41C Users' Library Solutions: Games 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

The object here is to perform a vertical descent ending in soft landing on the planet of your choosing. You select the planet before you begin by specifying the acceleration of gravity in feet per second per second. Some values are given below:

Body             g(f/s2)
Earth            32.2
Moon              5.32
Mars             12.3
Ganymede          5.25
Pluto             7.25
Icarus (asteroid) 0.394

For interest, zero and negative values of g are allowed. The fuel allocated, as calculated from g, is more than adequate for a minimum use landing. At least twice as much fuel as needed is given. Although it takes longer to calculate, 3 seconds is the time your burn is stretched over. You can only key a burn in during the zero of each three second count down.

Note that if zero or negative g is selected and you run out of fuel, you may not impact. In this case you will see "DEEP SPACE. . ." instead of the normal "VF=" for final velocity.

Instructions

Step

Instructions

Input Data/Units

Keys

Output Data/Units

1

Enter program

     

2

Key in gravity.

g(f/s2)

[XEQ] GRAVITY 

G=

3

 

 

 

FUEL=

 

 

 

 

*V=

 

 

 

 

A=

       

THREE...

       

TWO...

 

 

 

 

ONE...

       

ZERO...

4

You have one second during the "ZERO..." prompt to key in a fuel burn.

burn

 

 

5

Go to 3 for next status.    

 

6

For a new game with the same g go to step 3.

 

[A]

G=

 7

For a new game with a different g go to step 2.

 

 

 

         

*

When you see "VF= ", this is your landing or crash velocity.

 

 

 

Example

Try a landing on the moon (g = 5.32 f/s2).

   Keystrokes:          Display:
[XEQ] [ALPHA] 
SIZE [ALPHA] 007
5.32 [XEQ] [ALPHA] 
GRAVITY [ALPHA]         G=5.32
                        FUEL=5456
                        V=-500 F/S
                        A=5000 V 
                        THREE... 
                        TWO... 
                        ONE... 
                        ZERO... 
(to free fall, just do nothing) 
                        FUEL=5456
                        V=-516 F/S
                        A=3476 F
                        THREE...
                        TWO...
                        ONE...
                        ZERO...
20                      FUEL=5436
                        V=-512 F/S
                        A=1 934 F
                        THREE...
                        TWO...
                        ONE...
                        .
                        .
                        .

The Program

LINE  KEYS
 01 <>LBL "GRAVITY"          Initialize
 02  SF 27
 03  STO 01
 04  ABS
 05  800
 06  *
 07  1200
 08  +
 09  STO 05
 10 <>LBL A
 11  5000                    Set up the initial conditions
 12  STO 06
 13  -500
 14  STO 02
 15  RCL 05
 16  STO 03
 17  "G="
 18  FIX 2
 19  CF 29
 20  ARCL 01
 21  AVIEW
 22  PSE
 23  FIX 0
 24 <>LBL 09
 25  "FUEL="
 26  ARCL 03                 Display status
 27  AVIEW
 28  PSE
 29  RCL 02
 30  RND
 31  RCL 06
 32  .5
 33  "V"
 34  X>Y?
 35  "|-F"
 36  "|-="
 37  ARCL Z
 38  "|- F/S"
 39  AVIEW
 40  PSE
 41  X>Y?
 42  RTN
 43  "A="
 44  ARCL 06
 45  "|- F"
 46  AVIEW
 47  PSE
 48  RCL 03
 49  X=0?
 50  GTO 02
 51  "THREE..."              Countdown
 52  AVIEW
 53  PSE
 54  "TWO..."
 55  AVIEW
 56  PSE
 57  "ONE..."
 58  AVIEW
 59  PSE
 60  CLX
 61  "ZERO..."
 62  AVIEW
 63  PSE
 64  CLD
 65  STO 00                  Calculate acceleration
 66  ABS
 67  RCL 03
 68  X>Y?
 69  RDN
 70  ST- 03
 71  RCL 00
 72  SIGN
 73  *
 74  3
 75  /
 76  RCL 01
 77  -
 78  STO 04
 79  RCL 06
 80  *                       Calculate time to impact
 81  2
 82  *
 83  RCL 02
 84  X^2
 85  X<>Y
 86  -
 87  SF 00
 88  X<0?
 89  GTO 01
 90  SQRT
 91  RCL 02
 92  +
 93  CHS
 94  RCL 04
 95  X=0?
 96  GTO 01
 97  CF 00                   If greater than 3 seconds then use 3
 98  /
 99  3
100  X<>Y
101  X>Y?
102  RDN
103 <>LBL 01
104  FS?C 00
105  3
106  STO 00
107  RCL 04
108  *                       Delta V
109  RCL 02
110  +
111  X<> 02
112  RCL 00
113  X^2
114  RCL 04
115  *
116  2
117  /
118  X<>Y
119  RCL 00
120  *                       Delta Altitude
121  +
122  ST+ 06
123  GTO 09
124 <>LBL 02
125  "DEEP SPACE..."         Find velocity calculation
126  RCL 01
127  X!=0?
128  GTO 03
129  0                       g=0
130  STO 06
131  RCL 02
132  X<0?
133  GTO 09
134  PROMPT
135 <>LBL 03                 g!=0
136  RCL 01
137  RCL 06
138  *
139  2
140  *
141  RCL 02
142  X^2
143  +
144  X<0?
145  PROMPT
146  SQRT
147  RCL 02
148  +
149  RCL 01
150  /                       t
151  X<0?
152  PROMPT
153  RCL 01
154  *                       Delta V
155  ST- 02
156  0
157  STO 06
158  GTO 09
159  .END.

Register Use

R00  Used
R01  g
R02  Velocity
R03  Fuel
R04  Used
R05  Initial Fuel
R06  Altitude

Go back to the HP-41 software library
Go back to the general software library
Go back to the main exhibit hall