I have been looking for a Lunar Lander for TI-57/RCL-57 and I came across this older thread. I ended up writing my own version which I list here for anyone interested.
IMO, it has a few advantages over the one in "L'Ordinateur de Poche":
- It displays the sign of the velocity, making clear whether the rocket is descending or not
- There is no need to enter the fix mode
- It gives a clear indication that the game has ended (display blinking)
- It computes velocity and altitude every second, looking for landing or a crash, instead of doing so only every 10 seconds
Instructions:
- Key in the program
- Enter initial velocity: 100 STO 1
- Enter initial altitude: 2500 STO 2
- Enter initial fuel: 100 STO 3
- RST R/S
You should see "100" (fuel) followed by "100.2500" (velocity.altitude).
- 'N' R/S
where 'N' (N integer >= 0) is the number of gallons to consume in the next 4 seconds.
You should see "fuel" and, after a pause, "velocity.altitude"
- Repeat Step 6 until the display blinks
if >= 0, you landed safely
if < 0, you crashed
If you want to see your final velocity, press
RCL 1.
Code:
# Displays the current state.
RCL 3 INV Fix Pause # Fuel
RCL 1 x:t 1 +/- INV x>=t +/- # Compute sign of velocity
x
RCL 2 / 4 INV log + RCL 1 = Fix 4 # velocity.altitude
R/S
# Updates the fuel available
STO 4 # Number of gallons for the next 4 seconds
x:t RCL 3 INV x>=t STO 4 # Ensure it doesn't exceed quantity of fuel left
RCL 4 INV SUM 3 # Update fuel
# Loops 4 times (4 seconds)
5 STO 0 Lbl 0 INV Dsz RST
# Updates the altitude and velocity after 1 second
RCL 1 INV SUM 2 # Altitude
5 SUM 1 RCL 4 INV SUM 1 # Velocity
# Determines what happened in the last second
RCL 2 C.t INV x>=t GTO 7 # Crash: note the non existent label 7
6 x:t
RCL 1 |x| + RCL 2 = x>=t GTO 0 # Not landing: loop back
# Safe landing: if |velocity| + altitude <= 5, the display will blink (>= 0) since GTO 0 is at the last step (49)