Hero Coder finds a bug on a lunar lander after 55 years — "I suspect everyone else was just happy to play the game and have fun"

Action
Hero Coder finds a bug on a lunar lander after 55 years — "I suspect everyone else was just happy to play the game and have fun"

Apollo 11 landed on the Moon in 1969 at 7.20 AM, an achievement for all mankind that completely halted the first iteration of the space race. Neil Armstrong stepped into history as the world was 17-year-old schoolboy Jim Stoller among millions in sight and awe. 

Stoller, based in Massachusetts and with a considerable foundation in mathematics, was inspired by the concept of moon landing itself, thanks to his father, a physicist. Storer's school had the first commercially successful mini-computer, the PDP-8, and the young man set out to write a new program called the "Lunar Landing Game."

The text-based Lunar Landing Game, written in the early programming language FOCAL, would ask the player for instructions on each turn with the lander's height, speed, and remaining fuel calculated over each second in the game of descent. Essentially it's a game about using your fuel supply to slow down and control the descent of the craft, and when the craft reaches the surface, the player gets their

whole game is less than 50 lines of code, but its apparent simplicity belies the calculations underlying the simulation, and over the years the game has been programmed. Even then, various popular commercial versions add a visual layer (to give an idea of its longevity, Atari is currently developing an official sequel).

Software engineer Martin C.Martin announced in a new blog post that he had discovered and fixed a bug that has been dormant for 55 years since the game was coded (first discovered by Ars Technica) while playing with the code of the original game. The retired Martin's is the type of individual who has a brilliant career as a postdoctoral researcher at Rockstar, Meta, and MIT, and who sees exactly the kind of Lunar Lander and decides to devise the best strategy for a perfect landing.

"I recently considered the optimal fuel-burning schedule to land as gently as possible, with the largest remaining fuel," Martin wrote. "Surprisingly, the theoretical best strategy did not work. The game mistakenly believes that the lander does not actually touch down on the surface when it is not. Digging into it, I was surprised by the game's sophisticated physics and numerical calculations. Eventually I found a bug: there was no "divide by 2" that seemed to have been overlooked for nearly 55 years."

That is, Martin's perfect strategy was not registered by the game as a successful landing. The coder allows you to maximize speed by not using fuel and burn the full throttle at the last moment and close the speed to zero just before hitting the surface

"With some trial and error and a bit of (manual) binary search, you can barely find the schedule you're landing on. You don't burn anything for 70 seconds, and for the next 10 seconds it's 164.31426784 pounds per second and then up to 200 pounds per second," Martin wrote.

"The game considers a PERFECT LANDING to BE less than 1MPH, but here it lands above 3.5MPH and is said to be "maybe better." But IT burns EVEN at 0.00000001 POUNDS PER SECOND, rising at 114MPH AND COMPLETELY missing the SURFACE:

"How did WE COME to LAND from a HARD LANDING at all, and not TO MAKE A SOFT LANDING IN BETWEEN?"

When the coder began to examine the reasons, he wrote that "Tsiolkovsky rocket equations with Taylor series expansion of logarithms are not"the simple Euler integrations that are still common in video games today," but the more sophisticated equations that underpin the logic of the game." He also used some algebra to simplify it and reduce the amount of rounding errors. Very impressive for high school seniors in 1969.

Martin contacted Storer to confirm what he found and asked where this sophisticated math came from. "I was good at calculus at the time and I was familiar with concepts like Taylor series, but I also remember my father, a physicist, helping me derive equations.

In any case, the Rocket equation is what optimizes suicide burning, and the accuracy of the Taylor series suggests that it doesn't matter either. Instead, the problem was contact: the moment the lander lands.

"Imagine that the lander is descending at the start of a 10-second turn, but rises by the end," Martin wrote. "It's not enough to just make sure it's above the surface at both points. It may be soaked under the surface somewhere in between. When this happens, the program needs to rewind and look into the previous moment."

As Martin continues to explain, errors creep in when the game is trying to approximate the bottom of the orbit. The Coder presents his complete workout in a blog post, but in essence, for some reason "comes down to Storer using an alternative form of quadratic formula that lacks a 2 in the denominator within the square root." It was probably a simple error, either when deriving the formula or entering it into the computer."As Martin notes with caution, Storer had no access to algebra software and was doing all this with pencil and paper.

The missing "2" means that the game "consistently underestimates the time to the lowest point", which is supplemented by adding a percentage of time (0.05 seconds) and re-estimating the first estimate is while the lander is above the water surface and still descending, and then the second estimate is after reaching the bottom and rising again, less than 0.05 seconds. .

Martin explains the effects of fixing bugs, and spitball for some of the reasoning. "The theoretical total thrust landing suicide combustion takes about 148 seconds, but misses us

Martin ended by incorporating aspects of numerical calculations, paying tribute to the sophistication of the moon landing game coded in 1969 by a high school student," he said, although sadly there are some optimal landing strategies, even though the bug has been fixed. "I Ph.I didn't learn robotics until I was studying for D."

As for the bugs that have survived in some of the popular software for 55 years.

"It was probably because it was a fun game that was difficult and possible to land gently, even with bugs," Martin wrote. "The quest not only to win, but to find the best strategy can certainly lead to trying to understand small contradictions. I think everyone else was happy to play and enjoy the game.

If you are interested in the history of the Lunar lander, this 40th anniversary retrospective tells Storer himself about the creation of the game. And if you just like the old bug, here's doozy: The developer who returned to his game after forty years found and fixed the typo because it actually worked.

.

Categories