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
There's something timelessly appealing about lunar lander games. The very first game I ever played on a computer, written in BASIC, was a 'turn based' one dimensional lunar lander game where you input how much thrust you used for each second of the descent, and then it recalculated your altitude, velocity, etc. I learned programming by rewriting it to be a real-time game where you pressed a key to fire the engine.