3

A while ago I asked about the possible origin of a Russian version of the "Lunar Lander" game. No definitive answers were given.

Meanwhile, I was able to decompile the binary into a semi-readable form (search for "landing", near line 300). A few variable names had been guessed, some incorrectly or in a misleading fashion, as some of the variables were reused for unrelated purposes. This is still a work in progress. Caveat lector.

The game asked, WHAT IS YOUR EXPERIENCE? 0 1 2(STANDARD) 3 4 5 6 7 8 9(NO EXPERIENCE)

The amount of fuel was computed as fuel := round(15000 + level * 500);, then mass := 32500; drymass := mass - fuel;

When specifying the burn rate, it was possible to change the time step from the default 10 seconds to a lower number, down to 1 second.

A typical technique to do the landing is to free-fall for about 70 seconds, then to burn the maximum possible 200 lb/sec for about 65-70 seconds, then to start performing a more controlled descent.

I was able to write a simple program which has found winning sequences of burn rates for levels from 9 down to 2 (the standard 16000 lb), the latter using the 5-second interval, but nothing worked so far for harder levels (15500 or 15000 lb).

Assuming that BASIC versions of the game allowing to select the initial amount of fuel existed, and people have experience with them, my question is:

Was it at all possible to perform a successful landing using 15500 or less pounds of fuel, in any of such programs? The formulas in all of them are pretty much identical (*); the differences, if any, would be caused by variations in floating point representations, thus if a technique works in one of them, it should work in all.

Searching for "lunar lander best strategy" yields results related to other games.

As suggested by @lvd in the comments, the "launch" test results in (negative speeds are upwards):

ТIМЕ(SЕС) АLТ(МILЕS + FЕЕТ) VЕLОСIТУ(FРS) FUЕL(LВS)
    0            0       5        0        16000
   80           40     717    -6019            1
  153          120    3679    -5633            1

With the standard fuel load, the initial altitude is reached with the speed comfortably exceeding 1 mps (5280 fps).

With 15500 lb of fuel, it's getting close:

ТIМЕ(SЕС) АLТ(МILЕS + FЕЕТ) VЕLОСIТУ(FРS) FUЕL(LВS)
    0            0       5        0        15500
   78           37    4707    -5745            1
  157          120    3960    -5328            1

And with 15000 lb, it looks like a lost cause:

    ТIМЕ(SЕС) АLТ(МILЕS + FЕЕТ) VЕLОСIТУ(FРS) FUЕL(LВS)
    0            0       5        0        15000
   75           34    3642    -5486            1
  115           75    2410    -5275            1

It looks like the level 0 was deliberately unwinnable.

(*) It appears that a term in the rocket equation, log(Minit/Mfinal) = -log(Mfinal/Minit) = -log((Minit-Mspent)/Minit) = -log(1-Mspent/Minit), may be expressed incorrectly as log(1+Mspent/Minit), resulting in progressively imprecise calculations.

  • What is the initial speed of the lander? Does it move in 1D or in 2D? – lvd Aug 5 at 15:42
  • @lvd As in all text interface Lander games, it is 1D, the initial altitude is 120 miles, the initial speed is 1 mile per second. The game stems from one of the various BASIC language variants. There the amount of fuel is more than adequate, 16500 lb. – Leo B. Aug 5 at 16:16
  • 4
    So I suggest the following test (not quite accurate). Put lander on the surface and do full burn until the fuel is completely exhausted. Then see whether the capsule would reach 120 miles and with which speed. If the speed would be >1mps you probably have enough fuel to land. Otherwise (speed is less than 1mps upwards or not reaching at all) there is not enough fuel. – lvd Aug 5 at 19:11
  • @lvd: There were quite a few independently-derived text-based lander games, with varying degrees of sophistication. Some operated in one dimension; some in two. I'm not aware of any that used three, since setting the craft to an attitude such that the axis of rotation for one of the attitude control rockets was perpendicular to the plane upon which the craft was traveling wouldn't take much fuel, and would allow the problem to be reduced to a two-dimensional one. – supercat Aug 5 at 19:46
  • Completely off-topic, but Starship SN5 can do this easily. In 3D. In the real world. I guess if you let their control software calculate the Lunar Lander input, maybe it'll work, too ... – dirkt Aug 5 at 19:58
3

My final idea how to check solvability of the landing problem is the following.

  1. Let's assume the initial position of a lander: height is 120 miles above the surface, vertical speed is 1 mile per second downwards, purely 1D problem.

  2. The most extreme way to land is to fall freely until some point, where the full burn is applied until touchdown at zero vertical velocity. As the fuel amount is limited, there might be cases when the fuel is exhausted while the capsule still has some vertical speed at touchdown and therefore crashes.

  3. Now my idea is to reverse the problem starting from the lander standing on the surface, then apply full burn until no fuel, then see whether the lander would reach given height and with no less that given speed (this time upwards).

  4. There is however a discrepancy in the conditions during burn: for touchdown, burn starts with full mass (and non-zero speed) and ends with empty mass (and zero speed), while for takeoff it is in the other way: zero speed with full mass.

  5. Above is solved if you patch the code like this: Let the mass of the capsule before takeoff be empty (i.e. no fuel), then, while the engine burns, increase the mass proportional to the amount burnt, stop the burn when the mass reaches full (maximum fuel). This way the conditions are fully reversed and you can apply test from p.3.

| improve this answer | |
  • Alternatively, with 15000 lb, after 40 seconds of freefall, burning all the fuel at the max rate slows down the module to 56 fps at 35 mi of altitude. Freefalling lower would be even worse. Correcting the rocket equation helps a little, but still no cigar. – Leo B. Aug 7 at 8:16
  • 1
    I was eventually able to come up with a solution for 15500 lb, with zero fuel left at touchdown, after a manual tweak of a solution for 16000 lb which showed almost 500 lb of fuel remaining at touchdown. – Leo B. Aug 7 at 8:27
2

The answer turns out to be positive, although a smaller interval than the default 10 seconds is needed (Tx before the fuel rate requests switching the time interval to chr(x) - chr('0'), therefore "T:" means a 10-second interval.

MISSION CONTROL CALLING LUNAR MODULE:
MANUAL CONTROL IS NECESSARY FOR LANDING.
WHAT IS YOUR EXPERIENCE: 0 1 2(STANDARD) 3 4 5 6 7 8 9(NO EXPERIENCE) ?
WHAT IS YOURS ? 1
YOU MUST SPECIFY A FUEL RATE EACH 10 SECONDS.
RATES MUST BE ZERO OR BETWEEN 8 AND 200 LBS.PER SEC.
YOU HAVE 15500 LBS OF FUEL.
CAPSULE WEIGHT IS NOW 32500 LBS INCLUDING FUEL.
COMMENCE LANDING PROCED.
FIRST RADAR CHECK COMING UP:
 TIME(SEC) ALT(MILES + FEET) VELOCITY(FPS) FUEL(LBS)
    0          120       0     5280        15500
FUEL RATE= 0
   10          109    5016     5333        15500
FUEL RATE= 0
   20           99    4224     5386        15500
FUEL RATE= 0
   30           89    2904     5438        15500
FUEL RATE= 0
   40           79    1056     5491        15500
FUEL RATE= 0
   50           68    3960     5544        15500
FUEL RATE= 0
   60           58    1056     5597        15500
FUEL RATE= T80
   68           49    3633     5639        15500
FUEL RATE= 200
   76           41    2484     5204        13900
FUEL RATE= 200
   84           33    4911     4745        12300
FUEL RATE= T40
   88           30    1730     4766        12300
FUEL RATE= T:200
   98           21    4627     4151        10300
FUEL RATE= 200
  108           14    3354     3487         8300
FUEL RATE= 200
  118            8    3735     2763         6300
FUEL RATE= 200
  128            4    1127     1971         4300
FUEL RATE= 200
  138            1    1566     1095         2300
FUEL RATE= 200
  148            0     683      120          300
FUEL RATE= T414
  152            0     223      110          244
FUEL RATE= 59
  156            0       1        1            8
FUEL RATE= 8
FUEL OUT AT 157 SECONDS.
ON THE MOON AT 157 SECONDS.
IMPACT VELOCITY OF 2 F.P.S.
FUEL LEFT 0 LBS.
PERFECT LANDING. YOU LUCKY JET JOCKEY.
TRY AGAIN (2) OR NOT (0) ? PERFECT RECORD! NO FAIR USING CALCULATING AIDS.
MISSION CONTROL OUT.

And that's even with the "bad" rocket equation. The proper one, using -log(1-Mspent/Minit), is slightly more forgiving. Also, using finer intervals, it is possible to land with a few dozen pounds of fuel left.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.