Fundamentals 11 min read

Uncovering a 55‑Year‑Old Bug in the Original Lunar Lander Game

A retired software engineer revisits the 1969 text‑based Lunar Lander game, exposing a decades‑old mathematical error that causes the simulation to misjudge soft landings, and explains the physics, numerical approximations, and optimal burn strategies behind the classic program.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Uncovering a 55‑Year‑Old Bug in the Original Lunar Lander Game

Background

In July 1969, after the Apollo 11 Moon landing, 17‑year‑old Jim Storer wrote a text‑only Lunar Lander simulation for the PDP‑8 using the FOCAL language. The game reports altitude, velocity and remaining fuel every 10 seconds and asks the player to enter a fuel‑burn value between 0 and 200 lb for the next interval. A landing is considered "perfect" if the touchdown speed is below 1 mph; any crash, fuel exhaustion or collision with obstacles ends the game.

Physical model used in the game

Instead of a simple Euler integration, Storer implemented the exact Tsiolkovsky rocket equation. The change in velocity Δv is computed from the logarithm of the mass ratio, and the logarithm is evaluated with a five‑term Taylor expansion, giving sub‑micron precision for the typical descent parameters (mass‑ratio ≤ 0.1212). This approach eliminates most rounding error and makes the so‑called “suicide‑burn” (coast then full‑thrust at the last moment) theoretically optimal.

Bug discovered

Retired software engineer Martin C. Martin examined the source and found that the square‑root term in the denominator of the velocity‑time expression omitted a factor of 2. The correct term should be sqrt(2 · g · h) (or equivalent), but the implementation used sqrt(g · h). This missing factor causes the program to underestimate the time required to reach the trajectory’s lowest point, so the simulated lander appears to touch down at about 3.5 mph while the physics would actually produce a hard impact. Adding any infinitesimal extra burn after the estimated touchdown makes the craft miss the surface entirely and rebound upward at roughly 114 mph.

Corrected optimal burn plan

With the missing factor restored, the optimal “suicide‑burn” sequence becomes:

Coast with zero thrust for the first 70 seconds.

Burn fuel at a constant rate of 164.31426784 lb/s for the next 10 seconds.

Switch to maximum thrust ( 200 lb/s ) for the remainder of the descent.

This plan reduces the touchdown speed to about 1.66 mph , still above the 1 mph threshold but far closer than the original 3.5 mph result.

Implications of the bug

The bug demonstrates that the exact rocket‑equation solution is valid only while the lander is above the surface. Once the trajectory crosses the ground, the denominator error leads to an incorrect time‑to‑impact calculation, breaking the suicide‑burn optimality. The analysis also shows that a more gradual landing (e.g., reducing altitude and speed by the 14th interval and using low thrust in the 15th) can achieve a soft touchdown, but the theoretical full‑thrust suicide burn would require about 148 seconds of continuous maximum thrust.

Despite the flaw, the 1969 Lunar Lander remains a remarkable achievement for a high‑school student without formal computer‑science training.

Reference: https://martincmartin.com/2024/06/14/how-i-found-a-55-year-old-bug-in-the-first-lunar-lander-game/

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

physics simulationsoftware bugRetro GamingLunar LanderNumerical Methodsrocket equationTaylor series
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.