{"id":45106,"date":"2024-06-16T01:13:58","date_gmt":"2024-06-15T17:13:58","guid":{"rendered":"https:\/\/wp-productionenv-bjg9h2g2bgg5b8aa.southeastasia-01.azurewebsites.net\/news\/retired-engineer-discovers-55-year-old-bug-in-lunar-lander-computer-game-code-2\/"},"modified":"2024-06-16T01:13:58","modified_gmt":"2024-06-15T17:13:58","slug":"retired-engineer-discovers-55-year-old-bug-in-lunar-lander-computer-game-code-2","status":"publish","type":"post","link":"https:\/\/starpath.global\/news\/retired-engineer-discovers-55-year-old-bug-in-lunar-lander-computer-game-code-2\/","title":{"rendered":"Retired engineer discovers 55-year-old bug in Lunar Lander computer game code"},"content":{"rendered":"<p>On Friday, a retired software engineer named Martin C. Martin announced that he recently discovered a bug in the original <em>Lunar Lander<\/em> computer game\u2019s physics code while tinkering with the software. Created by a 17-year-old high school student named Jim Storer in 1969, this primordial game rendered the action only as text status updates on a teletype, but it set the stage for future versions to come.<\/p>\n<p style=\"\">The legendary game\u2014which Storer developed on a PDP-8 minicomputer in a programming language called FOCAL just months after Neil Armstrong and Buzz Aldrin made their historic moonwalks\u2014allows players to control a lunar module\u2019s descent onto the Moon\u2019s surface. Players must carefully manage their fuel usage to achieve a gentle landing, making critical decisions every ten seconds to burn the right amount of fuel.<\/p>\n<p>In 2009, just short of the 40th anniversary of the first Moon landing, I set out to find the author of the original <em>Lunar Lander<\/em> game, which was then primarily known as a graphical game, thanks to the graphical version from 1974 and a 1979 Atari arcade title. When I discovered that Storer created the oldest known version as a teletype game, I interviewed him and wrote up a history of the game. Storer later released the source code to the original game, written in FOCAL, on his website.<\/p>\n<figure class=\"ars-img-shortcode id-2031770 align-center\">\n<p>                <img loading=\"lazy\" decoding=\"async\" width=\"2476\" height=\"2026\" src=\"https:\/\/cdn.arstechnica.net\/wp-content\/uploads\/2024\/06\/lunar_lander_teletype_output.jpg\" class=\"attachment-full size-full\" alt=\"A scan of printed teletype output from the original Lunar Lander game, provided by Jim Storer.\" srcset=\"https:\/\/cdn.arstechnica.net\/wp-content\/uploads\/2024\/06\/lunar_lander_teletype_output.jpg 2476w, https:\/\/cdn.arstechnica.net\/wp-content\/uploads\/2024\/06\/lunar_lander_teletype_output-300x245.jpg 300w, https:\/\/cdn.arstechnica.net\/wp-content\/uploads\/2024\/06\/lunar_lander_teletype_output-640x524.jpg 640w, https:\/\/cdn.arstechnica.net\/wp-content\/uploads\/2024\/06\/lunar_lander_teletype_output-768x628.jpg 768w, https:\/\/cdn.arstechnica.net\/wp-content\/uploads\/2024\/06\/lunar_lander_teletype_output-1536x1257.jpg 1536w, https:\/\/cdn.arstechnica.net\/wp-content\/uploads\/2024\/06\/lunar_lander_teletype_output-2048x1676.jpg 2048w, https:\/\/cdn.arstechnica.net\/wp-content\/uploads\/2024\/06\/lunar_lander_teletype_output-980x802.jpg 980w, https:\/\/cdn.arstechnica.net\/wp-content\/uploads\/2024\/06\/lunar_lander_teletype_output-1440x1178.jpg 1440w\" sizes=\"(max-width: 2476px) 100vw, 2476px\"><\/p>\n<p>                A scan of printed teletype output from the original <em>Lunar Lander<\/em> game, provided by Jim Storer.<\/p>\n<p>                    Credit:<br \/>\n                                          Jim Storer<\/p>\n<\/figure>\n<p>Fast forward to 2024, when Martin\u2014an AI expert, game developer, and former postdoctoral associate at MIT\u2014stumbled upon a bug in Storer\u2019s high school code while exploring what he believed was the optimal strategy for landing the module with maximum fuel efficiency\u2014a technique known among <em>Kerbal Space Program<\/em> enthusiasts as the \u201csuicide burn.\u201d This method involves falling freely to build up speed and then igniting the engines at the last possible moment to slow down just enough to touch down safely. He also tried another approach\u2014a more gentle landing.<\/p>\n<p>,<\/p>\n<p>\u201cI recently explored the optimal fuel burn schedule to land as gently as possible and with maximum remaining fuel,\u201d Martin wrote on his blog. \u201cSurprisingly, the theoretical best strategy didn\u2019t work. The game falsely thinks the lander doesn\u2019t touch down on the surface when in fact it does. Digging in, I was amazed by the sophisticated physics and numerical computing in the game. Eventually I found a bug: a missing \u2018divide by two\u2019 that had seemingly gone unnoticed for nearly 55 years.\u201d<\/p>\n<h2>A matter of division<\/h2>\n<figure class=\"ars-img-shortcode id-1468945 align-center\">\n<p>                <img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"459\" src=\"https:\/\/cdn.arstechnica.net\/wp-content\/uploads\/2019\/03\/Apollo_Spacecraft_diagram.jpg\" class=\"attachment-full size-full\" alt=\"Diagram of launch escape system on top of the Apollo capsule.\" srcset=\"https:\/\/cdn.arstechnica.net\/wp-content\/uploads\/2019\/03\/Apollo_Spacecraft_diagram.jpg 720w, https:\/\/cdn.arstechnica.net\/wp-content\/uploads\/2019\/03\/Apollo_Spacecraft_diagram-300x191.jpg 300w, https:\/\/cdn.arstechnica.net\/wp-content\/uploads\/2019\/03\/Apollo_Spacecraft_diagram-640x408.jpg 640w\" sizes=\"(max-width: 720px) 100vw, 720px\"><\/p>\n<p>                Diagram of launch escape system on top of the Apollo capsule.<\/p>\n<p>                    Credit:<br \/>\n                                          NASA<\/p>\n<\/figure>\n<p>Despite applying what should have been a textbook landing strategy, Martin found that the game inconsistently reported that the lander had missed the Moon\u2019s surface entirely. Intrigued by the anomaly, Martin dug into the game\u2019s source code and discovered that the landing algorithm was based on highly sophisticated physics for its time, including the Tsiolkovsky rocket equation and a Taylor series expansion.<\/p>\n<p>As mentioned in the quote above, the root of the problem was a simple computational oversight\u2014a missing division by two in the formula used to calculate the lander\u2019s trajectory. This seemingly minor error had big consequences, causing the simulation to underestimate the time until the lander reached its lowest trajectory point and miscalculate the landing.<\/p>\n<p>Despite the bug, Martin was impressed that Storer, then a high school senior, managed to incorporate advanced mathematical concepts into his game, a feat that remains impressive even by today\u2019s standards. Martin reached out to Storer himself, and the <em>Lunar Lander<\/em> author told Martin that his father was a physicist who helped him derive the equations used in the game simulation.<\/p>\n<p>While people played and enjoyed Storer\u2019s game for years with the bug in place, it goes to show that realism isn\u2019t always the most important part of a compelling interactive experience. And thankfully for Aldrin and Armstrong, the real Apollo lunar landing experience didn\u2019t suffer from the same issue.<\/p>\n<p>You can read more about Martin\u2019s exciting debugging adventure over on his blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On Friday, a retired software engineer named Martin C. Martin announced that he recently discovered a bug in the original Lunar Lander computer game\u2019s physics code while tinkering with the software. Created by a 17-year-old high school student named Jim Storer in 1969, this primordial game rendered the action only as text status updates on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":45107,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":"","_links_to":"","_links_to_target":""},"categories":[2],"tags":[1651,9675,9677,9678,2043,9680,190,9681,21],"class_list":["post-45106","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","tag-apollo","tag-focal","tag-gaming-2","tag-jim-storer","tag-lunar-lander","tag-martin-c-martin","tag-nasa","tag-pdp-8","tag-space"],"acf":[],"_links":{"self":[{"href":"https:\/\/starpath.global\/blog\/wp-json\/wp\/v2\/posts\/45106"}],"collection":[{"href":"https:\/\/starpath.global\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/starpath.global\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/starpath.global\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/starpath.global\/blog\/wp-json\/wp\/v2\/comments?post=45106"}],"version-history":[{"count":0,"href":"https:\/\/starpath.global\/blog\/wp-json\/wp\/v2\/posts\/45106\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/starpath.global\/blog\/wp-json\/wp\/v2\/media\/45107"}],"wp:attachment":[{"href":"https:\/\/starpath.global\/blog\/wp-json\/wp\/v2\/media?parent=45106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/starpath.global\/blog\/wp-json\/wp\/v2\/categories?post=45106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/starpath.global\/blog\/wp-json\/wp\/v2\/tags?post=45106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}