I found a 55 year old bug in the first Lunar Lander game
Simulation and Physics Details
- Some expected a simple Euler-style integration each “turn”; the thread explains the original used closed-form equations (rocket equation + gravity) for efficiency on 1960s hardware.
- The game is turn-based, text-only, printing state in 10-second increments; internal simulation steps can be smaller than 10 seconds.
- Gravity is treated as effectively constant despite altitude change; thrust uses the rocket equation, approximated via a truncated Taylor series.
- The “suicide burn is optimal” claim is refined: fuel-optimality mainly comes from minimizing gravity losses; the rocket equation itself is time-insensitive.
Nature and Impact of the Bug
- The key bug lies in the landing detection: altitude must be below zero for a short time (~0.05 s) for the game to notice a touchdown.
- This interacts with approximations for both minimum altitude and touchdown time; strong thrust near the surface amplifies small timing errors into noticeable velocity differences.
- Some argue this is “just” a numerical inaccuracy, not a gameplay-breaking glitch or exploit. Others still find it notable given how small and carefully crafted the program is.
Assessing the Programmer’s Achievement
- There’s an extended debate about how “impressive for a high schooler in 1969” it is.
- One side emphasizes: extremely limited access to computers then, lack of prior game design patterns, compact FOCAL code (~2 KB), use of the rocket equation, Taylor series, iterative refinement, and clever approximations.
- Another side notes that the most impressive part may be gaining access to a computer and specialized physics knowledge, not that high school students are inherently incapable.
FOCAL Language and Implementation Notes
- Discussion of FOCAL quirks: unusual operator precedence (* over /, + over -) can cause subtle errors when porting; IF syntax is seen as restrictive.
- Line labels are structured digit pairs with “groups” that can function like subroutines via a DO command.
Strategy and Optimal Landing Debates
- Several comments explore whether a mathematically perfect, fuel-optimal soft landing is achievable given the bug and discretized inputs.
- Ideas include tweaking early vs. late thrust values and using exhaustive search over integer thrust sequences; results suggest limitations under integer-only constraints, with floating-point tweaks remaining an open, nuanced question.
Ports, Variants, and Cultural Impact
- Multiple people recall later ports (BASIC, calculators, terminals, 8-bit micros) and mechanical lander games, and describe the original as formative for their interest in programming and game development.
- There are side stories about buggy printed BASIC listings, editors inadvertently breaking code, and the general difficulty of learning from error-filled magazine programs.
Related Tangents
- Brief tangents discuss optimal braking strategies for cars and bikes, regenerative braking, and engine vs. friction braking.