[{"data":1,"prerenderedAt":424},["ShallowReactive",2],{"project-35090054":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":34,"aspects":35,"strip":44,"post_text":46,"what":47,"said":71,"maker_in_thread":184,"shape":196,"grid":200,"attempts":386,"same_week":387,"maker_shows":39,"maker_hidden":417,"reader_version":418,"card":419},"35090054","lunar-lander-autopilot","An autopilot for the lunar lander game","title","Show HN: I built an autopilot for the lunar lander game","https:\u002F\u002Fszhu.github.io\u002Flunar-lander-autopilot\u002F","szhu.github.io","szhu",1678419029,2023,277,69,173,3109,6,"legend","games","browser game autopilot","web_app",[24,25,26,27],"lunar lander","autopilot","javascript game","lander game","mixed",0.26,{"positive":31,"neutral":32,"mixed":33,"critical":33},12,15,3,33,{"performance":36,"execution":38,"idea":40,"design":43},{"positive":18,"critical":37},1,{"positive":39,"critical":39},2,{"positive":41,"critical":42},4,0,{"positive":42,"critical":42},[33,42,42,42,42,37,42,45,45,33,42,42,42,33,45,45,33,33,33,42,45,45,45,42,45,45,42,33,42,45,45,33,42,33,33,33,33,42,37,33],5,"I got pretty good at (and too addicted to) the lunar lander game from a few days ago...\n\nso I decided to make an autopilot for the lander based on what I felt like was the best strategy! Now I can have perfect landings every time without lifting a finger :D\n\nWriting the autopilot code was a lot more fun than I expected! It felt a bit like programming a robot.\n\nSource code: https:\u002F\u002Fgithub.com\u002Fszhu\u002Flunar-lander-autopilot\n\nOriginal lander HN post: https:\u002F\u002Fnews.ycombinator.com\u002Fitem?id=35032506",{"problem":48,"audience":54,"pricing":54,"motivation":55,"time_to_build":54,"stack":59,"openness":68,"stage":69,"team_size":70},{"value":49,"source":50,"evidence":51},"Lands the lunar lander game automatically without player input","maker",[52],{"id":53},"post",null,{"value":56,"source":50,"evidence":57},"Maker got addicted to the lunar lander game and wanted to build an autopilot for it",[58],{"id":53},[60],{"value":61,"source":62,"evidence":63},"JavaScript","commenter",[64],{"id":65,"by":66,"text":67},"35091622","ricardobeat","The target velocity is a factor of height, and the autopilot has “160” hardcoded as the ceiling, so going above that means it will never decelerate fast enough.…","open_source","launched","solo",{"praise":72,"objections":98,"requests":121,"questions":150,"alternatives":158},[73,87],{"value":74,"source":62,"evidence":75},"Autopilot lands gently and reliably",[76,80,84],{"id":77,"by":78,"text":79},"35090916","monkellipse","Nice! I also got hooked on the lander thing, really quick to pick up and good replay value! Your autopilot handles a gentle landing well. If I get the lander going sideways at…",{"id":81,"by":82,"text":83},"35100617","khalidx","This is awesome! The closest I got without the autopilot was 94 or so. The autopilot consistently scores 100+",{"id":85,"by":11,"text":86},"35098896","Update: I improved the algorithm. The autopilot now scores a \"perfect landing\" almost every single time, it lands very noticeably faster, and the code no longer contains a…",{"value":88,"source":62,"evidence":89},"Fun to test by sabotaging the lander before engaging autopilot",[90,94],{"id":91,"by":92,"text":93},"35090991","huevosabio","Love it! I started playing by disabling autopilot, putting the ship in complicated positions (e.g. spinning uncontrollably) and then turning the autopilot on, it's fun to which…",{"id":95,"by":96,"text":97},"35097762","dwringer","Thanks for this comment, I hadn't thought to try and sabotage my trajectory prior to engaging autopilot. I thought for sure it was gonna fail, but it managed to set me down…",[99,106,114],{"value":100,"source":62,"evidence":101},"Autopilot used far too much fuel with a conservative descent",[102],{"id":103,"by":104,"text":105},"35092363","simonh","That's cool, but it has a very conservative descent profile and would use a ton of fuel. Having played Kerbal I'm used to attempting fuel efficient landings, which means more of…",{"value":107,"source":62,"evidence":108},"Autopilot crashed when lander was flying too fast above 160 height ceiling",[109,113],{"id":110,"by":111,"text":112},"35091369","timmaxw","I wanted to go for a record of as many flips as possible. So I boosted up to 25,000 feet; started spinning until it was doing about one flip per second; waited a few minutes;…",{"id":65,"by":66,"text":67},{"value":115,"source":62,"evidence":116},"Did not work in Firefox on Debian for one commenter",[117],{"id":118,"by":119,"text":120},"35092874","_ZeD_","uhm... it doesn't seem to work, at least on my workstation (firefox on a debian)",[122,132,140],{"value":123,"source":62,"evidence":124},"Add realistic engine physics and nondeterminism",[125,128],{"id":126,"by":66,"text":127},"35091530","It’s amazing how a simple algorithm performs so well, the autopilot is able to recover from some pretty extreme situations, and does it gracefully. Adding some realism to the…",{"id":129,"by":130,"text":131},"35093116","giomasce","Especially nondeterminism. Everything you say is still deterministic, so either you're able to land or you're not. With nondeterminism it's more interesting. You have to make…",{"value":133,"source":62,"evidence":134},"Handle hardest crash and sideways landings",[135,139],{"id":136,"by":137,"text":138},"35091447","dropbox_miner","This is great but I'd like to see an autopilot that can do the hardest crash",{"id":77,"by":78,"text":79},{"value":141,"source":62,"evidence":142},"Make it available as a bookmarklet or easter egg in the original game",[143,147],{"id":144,"by":145,"text":146},"35091712","hawski","Would it be possible to put the autopilot in a bookmarklet for the original game?",{"id":148,"by":11,"text":149},"35091949","I really wanted to! But unfortunately none of the lander's stats are exposed as global variables, so the only way I could do it was by editing the code. (My commits are actually…",[151],{"value":152,"source":62,"evidence":153},"How to trigger autopilot on mobile",[154],{"id":155,"by":156,"text":157},"35091018","tiffanyh","Mobile? How to you trigger autopilot on mobile?",[159,166,177],{"value":160,"source":62,"evidence":161},"Original lunar lander game by ehmorris",[162,165],{"id":163,"by":11,"text":164},"35096758","Oh that sounds like fun, I would definitely play that. You should suggest it to the developer who made the game! https:\u002F\u002Fgithub.com\u002Fehmorris\u002Flunar-lander\u002Fissues…",{"id":148,"by":11,"text":149},{"value":167,"source":62,"evidence":168},"OpenAI Gym lunar lander environment",[169,173],{"id":170,"by":171,"text":172},"35093314","paradite","Lunar lander is a one of the problems in Open AI Gym, where you test AI against standard set of problems: https:\u002F\u002Fwww.gymlibrary.dev\u002Fenvironments\u002Fbox2d\u002Flunar_lander\u002F Then you…",{"id":174,"by":175,"text":176},"35092628","m00dy","very similar to https:\u002F\u002Fwww.gymlibrary.dev\u002Fenvironments\u002Fbox2d\u002Flunar_lander\u002F",{"value":178,"source":62,"evidence":179},"Race Condition game by Reaktor",[180],{"id":181,"by":182,"text":183},"35090992","000ooo000","Cool, neat code too :) Now do https:\u002F\u002Frace-condition.reaktor.com\u002F! I wanted to pour a few hours into race condition but I got it to complete a lap and never went back.",{"comments":185,"answered":39,"key":186},10,[187,190,193],{"id":188,"text":189},"35094784","That's a ceiling for the speed the autopilot is okay with letting the lander descend. There is no ceiling to how much hard it will try to \"apply the brakes\". I agree that the…",{"id":191,"text":192},"35098958","Update: I added a new algorithm, and I think it might be impossible to crash the ship now. Let me know if you can still reproduce the bug!",{"id":194,"text":195},"35103701","I admire your dedication! Thank you for sacrificing 38 minutes of screen time for a noble cause.",{"commenters":197,"max_depth":18,"maker_replies":185,"first_comment_mins":198,"lifespan_hours":199},50,146,41,[201,203,207,211,214,217,220,223,226,228,230,232,234,238,240,241,245,247,249,252,254,257,259,263,267,268,269,270,271,275,278,281,284,287,289,293,294,298,300,302,303,307,309,312,316,318,322,326,328,330,334,335,339,343,346,348,350,352,353,356,359,363,367,371,375,378,380,382],[103,42,33,202,104,42],"project\u002Fmixed\u002Fperformance",[204,42,42,205,206,42],"35092682","commenter\u002Fneutral\u002Fidea","mft_",[208,42,42,209,210,42],"35092827","commenter\u002Fneutral\u002Fnone","santiagobasulto",[212,42,42,209,213,42],"35093223","someweirdperson",[215,42,42,209,216,42],"35095597","TheMaskedCoder",[218,42,42,219,104,42],"35097327","other\u002Fneutral\u002Fnone",[221,42,42,219,222,42],"35094352","zengargoyle",[224,42,42,219,225,42],"35096460","clbrmbr",[110,37,37,227,111,42],"project\u002Fcritical\u002Fperformance",[65,37,37,229,66,42],"project\u002Fcritical\u002Fexecution",[188,37,42,231,11,37],"maker\u002Fneutral\u002Fexecution",[191,37,42,233,11,37],"project\u002Fpositive\u002Fexecution",[235,37,45,236,237,42],"35101846","project\u002Fpositive\u002Fperformance","manbash",[239,37,45,233,111,42],"35112085",[170,39,42,219,171,42],[242,39,33,243,244,42],"35093742","project\u002Fneutral\u002Fidea","hcrisp",[246,39,42,209,171,42],"35094056",[248,39,42,209,244,42],"35095783",[250,39,42,219,251,42],"35093993","opdahl",[253,39,42,219,171,42],"35094035",[255,39,42,219,256,42],"35103024","KomoD",[258,39,42,219,171,42],"35106105",[260,33,33,261,262,42],"35093140","project\u002Fmixed\u002Fidea","Nodraak",[264,41,45,265,266,42],"35091482","project\u002Fpositive\u002Fidea","marketdev",[126,45,45,236,66,42],[129,45,33,243,130,42],[95,45,45,236,96,42],[77,18,33,202,78,42],[272,273,33,243,274,42],"35091038",7,"mg",[276,273,42,219,277,42],"35091508","swyx",[279,273,42,219,280,42],"35091643","antoinealb",[282,273,33,243,283,42],"35092109","4gotunameagain",[285,273,42,219,286,42],"35093695","syntheweave",[288,273,42,209,283,42],"35097151",[290,291,45,236,292,42],"35102906",8,"mckirk",[194,291,42,209,11,37],[295,296,45,233,297,42],"35095259",9,"jkonline",[136,185,33,299,137,42],"project\u002Fneutral\u002Fperformance",[91,301,45,265,92,42],11,[85,31,42,236,11,37],[304,305,42,219,306,42],"35094432",13,"Aperocky",[81,308,45,236,82,42],14,[310,32,45,236,311,42],"35093067","ehmorris",[313,314,42,219,315,42],"35094385",16,"bjd2385",[181,317,42,219,182,42],17,[319,320,33,299,321,42],"35091888",18,"curiousgal",[323,324,33,299,325,42],"35091455",19,"josephcsible",[327,324,42,231,11,37],"35095060",[329,324,42,233,11,37],"35098946",[331,332,45,265,333,42],"35095687",20,"tired_and_awake",[163,332,42,219,11,37],[336,337,45,265,338,42],"35094433",21,"iandanforth",[340,341,33,299,342,42],"35091997",22,"handonam",[344,341,33,243,345,42],"35095851","dsmmcken",[174,347,42,219,175,42],23,[349,347,42,219,11,37],"35096488",[144,351,33,243,145,42],24,[148,351,42,231,11,37],[354,351,33,355,311,42],"35093051","maker\u002Fneutral\u002Fnone",[155,357,33,358,156,42],25,"project\u002Fneutral\u002Fnone",[360,357,33,361,362,42],"35091045","project\u002Fneutral\u002Fdesign","skipnup",[364,365,33,243,366,42],"35092206",26,"tommica",[368,365,42,369,370,42],"35093394","other\u002Fneutral\u002Fidea","acomjean",[372,373,42,219,374,42],"35093772",27,"kevinwang",[376,373,42,219,377,42],"35095418","mclightning",[118,379,37,229,119,42],28,[381,379,42,231,11,37],"35096595",[383,384,33,243,385,42],"35094214",29,"antegamisou",[],[388,393,398,402,407,412],{"id":389,"name":390,"points":391,"category":392},"35150345","Modern Font Stacks",335,"dev_tools",{"id":394,"name":395,"points":396,"category":397},"35161916","whatdoesthiscodedo.com",186,"ai",{"id":399,"name":400,"points":401,"category":392},"35084108","APIRank.dev",176,{"id":403,"name":404,"points":405,"category":406},"35166874","MCIWB",171,"languages",{"id":408,"name":409,"points":410,"category":411},"35143052","Counter",169,"data",{"id":413,"name":414,"points":415,"category":416},"35119681","Terminal Based Wikipedia",165,"productivity",false,"v2",{"id":420,"name":5,"line":6,"ai":417,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":29,"top":18,"kw":421,"maker":11,"domain":10,"tier":19,"attempts":42,"strip":422,"url":9,"mix":423,"praise":74,"objection":100,"sub":21},35090054,[24,25,26,27],"3000010553000355333055505503055303333013",[31,32,33,33],1793991061813]