Live data from Hacker News

Show HN: I built an autopilot for the lunar lander game

szhu.github.io

1–10 of 73 posts

Show HN: I built an autopilot for the lunar lander game

#1
I got pretty good at (and very addicted to) the lunar lander game from a few days ago...

so 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

Writing the autopilot code was a lot more fun than I expected! It felt a bit like programming a robot.

Source code: https://github.com/szhu/lunar-lander-autopilot

Original lander HN post: https://news.ycombinator.com/item?id=35032506

Show HN: I built an autopilot for the lunar lander game
szhu.github.io

Re: Show HN: I built an autopilot for the lunar lander game

#2
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 any appreciable speed, then flip autopilot on, a crash is inevitable :) As a human my solution to that is simply slowing down with lots of thrust, though I still wind up turning the lander into scrap most of the time hah!

Re: Show HN: I built an autopilot for the lunar lander game

#6
It's interesting to think about how the optimal strategy to land the lander would look like.

If the distance to the moon was large, I would expect 4 phases:

1: Turn the lander towards the moon

2: Constant thrust towards the moon

3: Turn the lander away from the moon

4: Constant thrust away from the moon

But if the initial distance is small enough, turning it around might not be worth it or even possible.

So the optimal strategy is probably a somewhat complex function of the initial angle and distance to the moon.

Re: Show HN: I built an autopilot for the lunar lander game

#8
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; then turned on the autopilot to come into a landing.

The autopilot did a perfect job of stopping the rotation and lateral motion, so the lander came down straight as an arrow. Unfortunately, the autopilot didn't even try to decelerate! I crashed into the moon at 0.9 degrees and 770 MPH.

Post reply on HN