HackerTrans
TopNewTrendsCommentsPastAskShowJobs

szhu

no profile record

Submissions

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

szhu.github.io
277 points·by szhu·3 ปีที่แล้ว·69 comments

comments

szhu
·3 ปีที่แล้ว·discuss
I think that's actually just an example of either ask culture or guess culture, depending on the context.

If the friend should only say yes if they really want to, then that's ask culture.

If the friend should feel obligated to say yes, then that's guess culture.

The only difference here is that the request is worded differently (as a statement rather than as a question), which is simply close friends adopting their own language conventions, a slightly-related but independent concept.
szhu
·3 ปีที่แล้ว·discuss
I admire your dedication! Thank you for sacrificing 38 minutes of screen time for a noble cause.
szhu
·3 ปีที่แล้ว·discuss
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!
szhu
·3 ปีที่แล้ว·discuss
Actually, I think my new algorithm fixes this -- and without any dedicated "swaying" edge case!
szhu
·3 ปีที่แล้ว·discuss
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 complicated, trial-by-error formula!

I got my first 103+ point landing! (It does this about half the time now)

https://user-images.githubusercontent.com/1570168/224399420-...
szhu
·3 ปีที่แล้ว·discuss
Oh that sounds like fun, I would definitely play that. You should suggest it to the developer who made the game!

https://github.com/ehmorris/lunar-lander/issues

https://news.ycombinator.com/item?id=35032506
szhu
·3 ปีที่แล้ว·discuss
oh no! I'm tried it on Firefox on Mac and it worked fine?

https://user-images.githubusercontent.com/1570168/224370129-...

https://user-images.githubusercontent.com/1570168/224369935-...
szhu
·3 ปีที่แล้ว·discuss
Oh yeah, the author of the game said he made use of a similar tutorial:

http://students.cs.ucl.ac.uk/schoolslab/projects/HT5/

from the readme here: https://github.com/ehmorris/lunar-lander
szhu
·3 ปีที่แล้ว·discuss
The art collective MSCHF did something similar and slightly more dystopian: https://childrenscrusade.com/
szhu
·3 ปีที่แล้ว·discuss
Thanks! Yeah it's just (1) rotate to follow the trajectory line and (2) slow down once you get close to the bottom.
szhu
·3 ปีที่แล้ว·discuss
oh yeah definitely. Left as an exercise for the reader??

(accepting PRs!)
szhu
·3 ปีที่แล้ว·discuss
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 target velocity calculation is off though. I was excited that I came up with something reasonably theoretically correct for correcting rotation... and for figuring out when to fire the engines I just gave up and eyeballed it :)
szhu
·3 ปีที่แล้ว·discuss
I really wanted to!

But unfortunately none of the lander's stats are exposed as global variables, so the only way I could make the autopilot was by modifying the existing code. (My commits are actually broken down exactly like this: a commit to expose the necessary variables globally, and another to actually add the autopilot.)

I would also love to be able to play it in the original game though, so I made a PR! I think it would be cool for it to be able to be activated as an easter egg.

https://github.com/ehmorris/lunar-lander/pull/7
szhu
·5 ปีที่แล้ว·discuss
Your carpet cannot negotiate a high power, but two devices might negotiate a high power while not being aware that that the cable has a cut in it and is in direct contact with the carpet.