A secret kept for 55 years: a bug in the code of the legendary game Lunar Lander was revealed

Tomcat

Professional
Messages
2,656
Reputation
10
Reaction score
646
Points
113
An enthusiast has unraveled the mathematical riddle of an ancient game about the moon.

Retired software engineer Martin K. Martin recently discovered a bug in the processing code of the legendary computer game "Lunar Lander", created back in 1969, the same one where you need to land a lunar module on the surface of the Moon. The discovery was made while studying the optimal landing strategy for the module with maximum fuel economy.

The first version of the game "Lunar Lander" (from English "Lunar Module") was written by a 17-year-old schoolboy Jim Storer on a PDP-8 minicomputer using the FOCAL programming language. The game text displayed only status updates about the position of the lunar module during landing on the lunar surface. Gamers had to carefully manage their fuel consumption to ensure a soft landing, making critical decisions every 10 seconds about the amount of fuel burned.

This primitive game paved the way for future versions. In 1974, a graphical version appeared, and in 1979, an arcade game from Atari, thanks to which "Lunar Lander" became widely known. For the 40th anniversary of the first manned landing on the moon in 2009, an enthusiast found the author of the original game, Jim Storer, interviewed him and compiled the history of the creation of "Lunar Lander". Storer later published the game's source code on his website.

After analyzing the code in 2024, AI expert and former MIT researcher Martin K. Martin identified an error in the implementation of physical calculations. The bug was triggered when trying to land as efficiently as possible using the "suicide braking" technique, known among fans of the game Kerbal Space Program. This strategy involves a free fall to increase speed and then turning on the engines at the very last moment for safe braking.

"I recently researched the optimal fuel burn mode for the softest possible landing with high residual thrust," Martin wrote in a blog post. - Unexpectedly, the best strategy in theory didn't work. The game mistakenly thought that the module did not touch the surface, although in fact it did. As I delved deeper, I was struck by the complexity of physical calculations and numerical calculations in the game. As a result, I found a mistake: the absence of the division by two operation, which, apparently, has not been noticed by anyone for almost 55 years."

It's all about division
Despite applying a seemingly perfect landing strategy, the game controversially reported that the module completely missed the lunar surface. Intrigued by this anomaly, Martin studied the source code and discovered that the landing algorithm was based on advanced physics for that time, including the Tsiolkovsky equation of rocket motion and the Taylor series.

As mentioned in the quote above, the root of the problem lay in a banal computational oversight - the lack of division by two in the formula that calculates the trajectory of the lunar module. This seemingly insignificant omission had serious consequences, leading to incorrect calculation of the time before landing and the landing itself. Despite the mistake, Martin was impressed that Storer, as a high school student, was able to introduce advanced mathematical concepts to his game, which is still a significant achievement today.

After contacting Storer himself, Martin learned that the author's father, Lunar Lander, was a physicist and helped his son derive equations for a game simulation.

Although people have been playing the Bug Storer game for years, it shows that realism isn't always the most important part of an immersive interactive experience. And fortunately for Aldrin and Armstrong, the real Apollo lunar mission did not suffer from such a mistake.
 
Top