11 ms·
I found a 55 year old bug in the first Lunar Lander game
- zug_zug 2y agoIt's interesting. The naive way to write this would be not use any special formulas, and just recalculate mass and acceleration each frame (based on the new mass). And to calculate intersection with the ground at each frame boundary. I guess the idea is that the lower your frame-rate, the less accurate this approach is, or maybe the idea is it's fun to use the actual equations. I'm curious how perceptible the difference is between the two at the original framerate.
- moconnor 2y agoThere wasn't any graphical output or any frame rate to speak of in the sense you are thinking. The output would appear printed, like this: https://www.cs.brandeis.edu/~storer/LunarLander/LunarLander/LunarLanderSampleOutputPage2.jpg https://www.cs.brandeis.edu/~storer/LunarLander/LunarLander/... Only updating the mass/acceleration at ten-second intervals would be wildly incorrect!
- zug_zug 2y agoOh, thanks. There was an arcade game called Lunar Lander and I thought that this was the exact same thing, and I guess I didn't pay much attention to the pictures.
- vlovich123 2y agoJust because your displaying results in 10s increments doesn’t mean anything about the simulation frame rate. You could still simulation 10k frames at 1ms granularity between the results printed each ms. The challenge is computational for a 1960s machine and a closed form solution is sensible here for that reason.
- martincmartin 2y agoOP here (of this blog post, not the original game). The naive way is what I expected too, and described as the Euler method in the post. In terms of physical accuracy, especially when you get near the surface, the mass does change significantly if you have a high rate of fuel burn. But in terms of how challenging/fun it would be, and what strategies you use as a player, I doubt it would make much difference. In fact, there are other lunar lander simulations in the BASIC computer games book, I think one of them does use the naive approach. If 10 seconds is too long, you could still leave that as the turn in the UI, but internally break each turn into a bunch of smaller time steps, e.g. 10 time steps of 1 second each. Actually, the existing game does that in certain places, which is why his physics simulation takes in an arbitrary time S rather than always the full 10 seconds.
- jihadjihad 2y agoPretty cool, the offending line seems to be 08.10 [1]. I thought it was a little odd that he mentioned "impressive for a high school senior in 1969" multiple times throughout -- honestly I would imagine that growing up in the Space Age would have had a massive influence on technically minded folks, reminds me of that movie from a while back called October Sky. In the interview in TFA with the game's author he mentions being skilled at calculus--seems to me that if you were interested in space/rocketry/etc. and had the aptitude it makes sense that you'd try your hand at programming a lunar landing game. [1]: https://www.cs.brandeis.edu/~storer/LunarLander/LunarLander/LunarLanderListingText.txt https://www.cs.brandeis.edu/~storer/LunarLander/LunarLander/...
- realslimjd 2y agoThere were on the order of hundreds of high school students with computer access in the US in 1969, and even fewer with computer literacy. Growing up in the Space Age probably was inspirational, but that doesn't change the fact that computers basically didn't exist to the general public at that time. Unlike now, software development wasn't a widely known career. There wasn't a CS major in the US until 1962. I think that makes it pretty notable he was a high school senior in 1969.
- layer8 2y agoIt’s unsurprising that at least one of the hundreds would write such a game though? In particular when those having access already are self-selected to some degree.
- bee_rider 2y agoIt’s unsurprising that anything was done by somebody. In fact it is inevitable that the most impressive thing is done by somebody out there, because otherwise it wouldn’t be a thing that was done. But, being that person can still be impressive.
- BobaFloutist 2y agoIt's unsurprising that someone is the best at the world at running, but it's still pretty impressive when they do it.
- luxuryballs 2y agoI wonder if this works for braking in automobiles to minimize brake pad wear.
- Jerrrrry 2y ago[dead]
- lionkor 2y agoAutomobiles are more (wear-)efficient at braking when they use the engine to brake, not the brakes, so that would probably be a better approach to automate
- dadadad100 2y agoA long time ago, in a book whose title I don’t remember, a character said, “but engine parts are more expensive than brake parts”. That has always stuck with me, even as I glide to a stop with almost no braking.
- ljf 2y agoVery true - but I drive cars until they die - and have never had a car issue because of engine braking - it is usually another part of the car that goes before whatever damage I am adding to the engine, becomes an issue. So engine brake away!
- settsu 2y agoAs an avid engine braker who lives in a hilly area and drives in the foothills/mountains often, I figure that at the relatively inconsequential loads and speeds my passenger vehicles operate under, I'm simply leveraging the engine's already constant state of wear while preserving my brakes for a moment when I may need their optimal stopping performance.
- somat 2y agoTrue, however that statement sort of makes the assumption that engine braking is the same ablative system as friction braking. with the same wear characteristics. I have to admit I don't know the exact wear characteristics of an IC engine in breaking operation but I don't think it is any different/more than it's normal running wear.
- kelsey98765431 2y ago[flagged]
- lionkor 2y agoNot just you, but there is an option to learn more and then deny all.
- Viliam1234 2y agoI agree with you in abstract, but uMatrix solved this problem for me. Also, it's funny how people often say "the stupid cookie banners are there because of GDPR", but actually GDPR requires that the Reject button be as large and as easy to click as the Accept button, and somehow most companies do not care about this part. (Also, GDPR does not require a cookie banner when your website does not place cookies. Seriously, why do you need them for the users who are not going to log in?)
- 93po 2y agoPeople blame GDPR when they should blame the companies for invasive tracking. It's like making it illegal to serve poison in food, then being annoyed that your restaurants have to get your consent to serve you poison. > why do you need them for the users who are not going to log in? because they store cookies in your browser regardless, for tracking and advertising purposes
- lucb1e 2y ago> GDPR does not require a cookie banner when your website does not place cookies You can place cookies and not need a cookie banner. You just can't use consent as a legal basis when you haven't yet asked for consent, that's the only thing all these websites are doing: no legitimate reason for the invasive tracking they want to do and thus they're legally obliged to ask you in a clear way if you will consent to it. If the data processing were to fall under a reason such as: - in order to fulfill a contract (such as your visitor asking the website to log them in) - or a legitimate interest (murky, but aggregated statistics like setting returnVisitor=true should fall under this) - or one of the other reasons defined in GDPR (I think there are three more besides consent, like public interest, vital interest of the subject, and one more I forgot) then you don't need to ask for consent to process this data or, specifically in this case, place this cookie.
- ghdhhdh 2y ago[flagged]
- benjedwards 2y agoIf anyone is curious, in 2009, I discovered that Jim Storer was the author of the first Lunar Lander game and interviewed him about it (and also chronicled the history of the game beyond that). He later provided the source code, which was awesome. https://technologizer.com/2009/07/19/lunar-lander/index.html https://technologizer.com/2009/07/19/lunar-lander/index.html My favorite part is this: “After leaving high school I never thought about the game again,” says Storer. “Until about a couple of months ago when someone e-mailed me about this, I was completely unaware of any Lunar Lander game other than the one I wrote in high school.”
- acyou 2y agoWow, that is a great article. Incredible research and depth. Thanks for the contribution.
- scrame 2y agodude,that's awesome!
- nox101 2y agoThat's awesome I just wanted to add, there's also mechanical lander games that pre-date lunar lander I can't find a picture. IIRC the machine was something like this https://content.invisioncic.com/r322239/monthly_10_2015/post-12370-0-56751800-1446253714.jpg https://content.invisioncic.com/r322239/monthly_10_2015/post... Except it had terrain and pits. A pit would light up and you needed to land in the pit (your ship landing would depress the button in the center of the pit). If you didn't aim well your ship would hit the edge of the pit, tilt, and you'd fail. If you did hit the button then the light would go off and a different pit would light up. -- update -- now that I think about it, maybe the controls were more like UFO catcher where you'd align at the top and then press "land". Anyway, it used to be at Disneyland at the Main Street Arcade.
- popctrl 2y agoI played the game in this picture at the pinball museum in vegas. One lever operates the rear fan and the other operates the bottom fan. It was a lot of fun for an analog arcade game. I returned to the museum a few years ago and it was no longer working. I hope they fix it one day.
- probably_wrong 2y ago> By 1973, it had become “by far and away the single most popular computer game.” On Lunar Lander and bugs: my first programming book had a version of this game in Basic that I never got to run correctly. 25 years later I came back to it and I was surprised at the ridiculous amount of bugs it had and the convoluted logic ("440 IF <condition> GOTO 450"). I eventually rewrote it as an adult [1] but young me stood no chance. And to this day I wonder what happened inside that forgotten Spanish editorial that turned (almost) working code into whatever made it to the final version. [1] https://7c0h.com/blog/new/moon_landing_in_basic.html https://7c0h.com/blog/new/moon_landing_in_basic.html
- darknavi 2y agoProbably copy/paste errors (in editorial) mixed with deadlines mixed with no QA.
- yourapostasy 2y agoOy vey, "no chance" is putting it lightly. A lot of this BASIC code had roots in the 1960's-70's. Back then, editors ruled the roost of print magazines where this code often showed up within, and in books of collections of code they especially ruled with an iron fist. There was little notion that source code had to be dropped in verbatim with absolutely zero changes, so editors would make "judicious" changes in the source code. They thought they were "helping" with "obvious" typographical and editorial decisions. This lesson was slowly, painfully learned until material improvements across the industry started to take hold starting in the 1980's and realization that source code shouldn't be touched in print really began to permeate the print industry. Though sometimes I wonder if this dynamic spurred the rise of BBS' and helped loosen the stranglehold print media had upon source code distribution, and what an alternative timeline might have looked like if the ones in power in print media were more open to "outsiders" having absolute control over some portion of "their" content. I learned all the above decades later after I first started playing around with coding as a child, from talking with a much older friend who rose up from within the print media world and saw what happened. When I was a child, with zero adult guidance, and only a handful of books from the school and community library about programming, it was a wonder I stuck with coding at all with the countless programs I typed in by hand from print media that were similarly riddled with errors, so your reminiscing brought back powerful memories.
- dn3500 2y agoI was confused for a minute because I remember playing Spacewar on a PDP-1 in the 1960s and mis-remembered there also being a lander game. But there wasn't, Storer was the first. There is an interesting history here: https://www.acriticalhit.com/moonlander-one-giant-leap-for-game-design/ https://www.acriticalhit.com/moonlander-one-giant-leap-for-g...
- efields 2y agoIs it really a bug if it hasn't affected the integrity of the game for 55 years? ducks
- smcin 2y agoAgreed. It's a numerical error that only affects accuracy, but not a serious glitch, like the Pac-man Kill Screen Bug, not exploitable (to cheat/get resources/lives, like reaching 990,000 points in Defender), and not an Easter egg. See e.g. Glitchipedia: https://errors.fandom.com/wiki/Glitchipedia:About https://errors.fandom.com/wiki/Glitchipedia:About
- schiffern 2y ago>The rocket equation is what gives rise to the suicide burn being optimal Nitpick, but this isn't strictly true. Even if you don't count the vehicle getting lighter as it burns fuel (which is all the rocket equation does here), a suicide burn will still be optimal. The real reason is because a suicide burn minimizes gravity loss. https://en.wikipedia.org/wiki/Gravity_loss https://en.wikipedia.org/wiki/Gravity_loss
- martincmartin 2y agoOP here. True, I oversimplified. What I meant was, there are two parts to the dynamics, the rocket equation and gravity. They add linearly, so any extra velocity that comes from gravity needs to be eliminated by increasing the delta V from the rocket equation. The gravity delta V is just acceleration of gravity times time, so you want to minimize the time. Surprisingly (to me), in the rocket equation, it doesn't matter how long it takes, or what sequence of burns you use, or whether you burn at a constant rate all the way through vs short strong bursts, etc. So to land with zero velocity using the least fuel, you just need to land in the shortest amount of time.
- sema4hacker 2y agoIn the mid 70's I wrote a 2D vector graphics moon lander game for the Adage graphics terminal. You came in fast horizontally and had to use push buttons for the LEM side thrusters and main engine to slow down and land horizontally, resulting in either a crater if you were too fast, or if you ran out of fuel, otherwise you saw one or more planted American flags depending on the quality of the landing. Years ago I threw out my only copy of the source code, thinking it had no value and would never be re-used, something I regretted later when I realized how early a graphics game it was historically, and how easily it could have beeen resurrected with a simple emulation.
- sema4hacker 2y agoWhoops, I meant "land vertically".
- schiffern 2y ago>It’s also possible to land gently, you just need to end your 14th turn with a low altitude and velocity, and then use low thrust in your 15th turn, landing somewhere after 150 seconds. It’s just the theoretical full-thrust-on-landing suicide burn, that takes around 148 seconds, that eludes us. I expect the fuel-optimal soft landing strategy (ignored because it doesn't fit the exact form of a "suicide burn") would be to play 164.31426784 lbs/second at t=70 seconds, and then replace one of the subsequent 200 lbs/second inputs with 199.99999999 lbs/second. The earlier you "play" 199.99999999 the better, so just use exhaustive search and select the earliest play that still achieve a soft landing.
- martincmartin 2y agoThe nature of the bug is that it has trouble finding when the lander has touched the surface. You need to have an altitude of less than zero for around 0.05 seconds for the game to notice that you've landed. If your thrust during that time is 200 or 199, to have an altitude < 0 for that long, then you need to have a speed greater than 1 MPH when your altitude is zero. Even when the bug is fixed, the code is still only approximating the lowest point. Also, even when it detects that you've landed, now it needs to compute the time when you land, i.e. when the altitude is zero, not velocity. It also uses an approximation for that. So the times will be a little off. If you're burning 200 or 199 during that last time step, you have a high acceleration so even a small amount of time turns into a large amount of velocity. Instead, if you're burning say 10 lbs/sec, then being off by say 0.08 sec won't change your velocity much.
- schiffern 2y agoI get what you're saying, but I don't think that contradicts the optimal strategy I outlined? Rather than a large deviation from a suicide burn at the end of the burn, a small deviation at the beginning of the burn should be a cheaper way (w/r/t fuel burn) to "search" the buggy code for a possible soft landing solution. Anyway, what a fun write-up! Thanks for posting it.
- martincmartin 2y ago
- Kiro 2y agoSurely the game must have hundreds of bugs like any other game.
- qup 2y agoGiven the simplistic nature of the game, I'm not convinced.
- TheRealPomax 2y agoWhy? This is from a time when there weren't any "other games". Heck, there were no computer games, period: there were only applications that could be described as "a sort of game on the computer" but only in the sense that you were asked to perform a task, tell the application what you though the task parameters should be, and then the application told you whether you were right. Applications were also still measured in bytes (the idea of the average program being so large that everything needed to be described in kilobytes was still in its infancy). So you literally didn't have enough space to hide 100 bugs that would linger unnoticed for 55 years: 100 bugs would be your entire source code. In fact, here's the source code for the game in the article: https://www.cs.brandeis.edu/~storer/LunarLander/LunarLander/LunarLanderListingText.txt https://www.cs.brandeis.edu/~storer/LunarLander/LunarLander/... - it's 2027 bytes. If it had 100 bugs, or even 5, it either wouldn't run, or it would be obviously wrong. And that source code also illustrates the kind of "game" this is: it's just a text prompt to get you to fill in the values that set up the flight, and then it runs a simulation with your parameters and spits out the result. That was enough to constitute a game people would play religiously, back in the day. Things changed a lot since then =D
- anyfoo 2y agoThe game is tiny. It does not even have any graphics. It would be an impressive feat to fit even 10 bugs in there, and still have it seem like a functioning game.
- methuselah_in 2y agoThat's why old people manage to create such great things. Writing game damn
- TheRealPomax 2y ago...what? The game was made by a teenager. The only reason they're now old is because 55 years have passed.
- csa 2y agoOh, fond memories. I learned BASIC programming when I was 11 in 1981 (I think that’s right) at a summer computer camp on an Apple II. I made a simplified version of lunar lander… it was ridiculously fun to make and play. One of my cohort mates who was in the “advanced” Pascal class is still my friend to this day.
- martincmartin 2y agoOP here. Cool! I was born in 1969, less than a month before Neil Armstrong walked on the moon, and was only a few months old when this game was written. I too learned BASIC, then spent hours pouring over the book "BASIC Computer Games", before I even had a computer of my own. Fond memories, as you say.
- ck2 2y agovaguely related 1962 Spacewar video game on a PDP-1 on punchout PAPER TAPE blew my mind https://en.wikipedia.org/wiki/Spacewar%21 https://en.wikipedia.org/wiki/Spacewar%21 video of game is at 30 second but whole thing is a great watch https://upload.wikimedia.org/wikipedia/commons/5/58/Restored_PDP-1_Demonstration.webm https://upload.wikimedia.org/wikipedia/commons/5/58/Restored...
- GeorgeTirebiter 2y agoWhen I made the proposal to restore the CHM's pdp-1, the reason was "Spacewar!"
- smarks 2y agoWow, pretty amazing. I remember playing this game after somebody ported it to Wang 2200 BASIC sometime in the mid 1970s. I didn't figure out how to land it myself, but I remember being shown the technique of coasting for the first several turns before applying maximum thrust. I don't recall the term "suicide burn" though. (Or maybe that term came in later when the Kerbal Space Program became popular.) I also remember this lunar lander game running on a couple terminals at the Lawrence Hall of Science in Berkeley, California, also in the mid 1970s. I don't know what computer it was running on though. I never looked at the source code for this program. I had no idea how sophisticated the math was. I wouldn't have understood it anyway, as I was too young in the mid 1970s. Then again, I'm not sure I'd be able to understand it now....
- dmckeon 2y ago> I also remember this lunar lander game running on a couple terminals at the Lawrence Hall of Science in Berkeley, California, also in the mid 1970s. I recall lunar lander being available on, IIRC, ADM-3 terminals at Lawrence in early 1973, usually surrounded by a cluster of male teens. One "feature" of the kiosk mode for games was that a carefully-timed Ctrl-C would escape kiosk mode, and allow the user to play other games. Happenstance, or catnip for proto-hackers?
- fl7305 2y agoI played the ABC-80 version of Lunar Lander way back then. Checking today, it seems to use a simpler Euler integration instead, and a curious value for G (?)
- readingnews 2y agoI still have a roll of punch tape, I think for a PDP11, that says "Lunar Lander" on it, and I have no idea who to give it to.
- aspenmayer 2y agoInternet Archive or Computer History Museum? Ask @textfiles for recommendations for places that might be interested.
- deleted 2y ago[deleted]
- sigzero 2y agoIt's probably why I kept crashing!
- swayvil 2y agoThat theme song. It still rattles in my head.
- HappyCoder314 2y ago[flagged]
- jnord 2y agoI first played this game on an HP-25 calculator back in 1976, using the same formulas as the article explains. https://www.hpmuseum.org/software/25moonld.htm https://www.hpmuseum.org/software/25moonld.htm
- emmelaich 2y agoI played it on a hp97/hp67. Memory hazy, but I think I used the inbuilt calculus features of the calculator to get a perfect landing with a burn of 45 (about half the fuel) on say turn 12. I had no prior expectation of what the optimum burn was and certainly had not heard of a 'suicide burn'.
- gwab 2y agoOne of the creators of Myst (Rand Miller) credited the original game with being why he got into game development in the first place [1] Myst inspired many people to go into computer science and game development as well, so it's interesting to see how much of a snowball effect this Lunar Lander game had [1] https://www.youtube.com/watch?v=EWX5B6cD4_4&t=1099s https://www.youtube.com/watch?v=EWX5B6cD4_4&t=1099s
- dhosek 2y agoI remember playing a version of this on a TI programmable calculator back in the 80s. There was also a graphical version for an assortment of 8-bit computers where you could navigate over the lunar surface in search of a flat landing area.
- vardump 2y agoPerhaps someone will fix contemporary game bugs in year 2500 and write a similar article.