Post Reply 
TI-57 Lunar Lander ?
06-04-2022, 06:22 PM (This post was last modified: 06-04-2022 08:19 PM by pauln.)
Post: #21
RE: TI-57 Lunar Lander ?
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:
  1. Key in the program
  2. Enter initial velocity: 100 STO 1
  3. Enter initial altitude: 2500 STO 2
  4. Enter initial fuel: 100 STO 3
  5. RST R/S
    You should see "100" (fuel) followed by "100.2500" (velocity.altitude).
  6. '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"
  7. 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)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
TI-57 Lunar Lander ? - Gene - 02-02-2019, 06:11 PM
RE: TI-57 Lunar Lander ? - Didier Lachieze - 02-02-2019, 06:31 PM
RE: TI-57 Lunar Lander ? - badaze - 02-02-2019, 07:37 PM
RE: TI-57 Lunar Lander ? - Thomas Klemm - 02-02-2019, 07:32 PM
RE: TI-57 Lunar Lander ? - Thomas Klemm - 02-02-2019, 08:46 PM
RE: TI-57 Lunar Lander ? - Thomas Klemm - 02-02-2019, 10:32 PM
RE: TI-57 Lunar Lander ? - ijabbott - 02-03-2019, 08:09 AM
RE: TI-57 Lunar Lander ? - EdS2 - 02-03-2019, 09:26 AM
RE: TI-57 Lunar Lander ? - David Hayden - 02-07-2019, 07:54 PM
RE: TI-57 Lunar Lander ? - Thomas Klemm - 02-03-2019, 11:34 AM
RE: TI-57 Lunar Lander ? - Thomas Klemm - 02-03-2019, 11:35 AM
RE: TI-57 Lunar Lander ? - EdS2 - 02-04-2019, 12:17 PM
RE: TI-57 Lunar Lander ? - Thomas Klemm - 02-04-2019, 08:50 PM
RE: TI-57 Lunar Lander ? - StephenG1CMZ - 02-06-2019, 10:42 PM
RE: TI-57 Lunar Lander ? - Thomas Okken - 02-04-2019, 10:42 PM
RE: TI-57 Lunar Lander ? - Paul Dale - 02-07-2019, 04:27 AM
RE: TI-57 Lunar Lander ? - Thomas Okken - 02-07-2019, 05:35 PM
RE: TI-57 Lunar Lander ? - SlideRule - 02-05-2019, 01:45 PM
RE: TI-57 Lunar Lander ? - Gamo - 02-06-2019, 05:10 AM
RE: TI-57 Lunar Lander ? - pauln - 06-04-2022 06:22 PM
RE: TI-57 Lunar Lander ? - Thomas Klemm - 06-12-2022, 07:00 PM
RE: TI-57 Lunar Lander ? - Thomas Klemm - 06-12-2022, 07:13 PM
RE: TI-57 Lunar Lander ? - pauln - 06-12-2022, 07:38 PM



User(s) browsing this thread: 1 Guest(s)