Rajathbharadwaj / NetHack-2021

Nethack 2021 codebase implementations
0 stars 0 forks source link

Kicking down doors #5

Open paulkent-um opened 1 year ago

paulkent-um commented 1 year ago

Some doors the agent encounters are locked. Sometimes, locked doors block the only path(s) to the stairs. If you don't have a specialized item, like a lockpick, credit card, skeleton key, or pickaxe, your only choice is to kick down the door. Thus, the agent should be prepared to kick down doors when necessary. However, this should only be done after checking the obvious paths, since kicking down doors is dangerous (you might offend a shopkeeper, hurt your leg, or awaken a dangerous monster).

I actually tried incorporating this general behavior into the agent's movement logic a couple days ago, but I failed rather spectacularly, making a major spaghetti code mess of everything and ultimately forcing me to revert to my last commit. The issue is that the pathfinding logic isn't really set up to incorporate actions like "kick" which take more than one step to resolve (in the case of kicking, one step to press kick, and another to indicate a direction). I think this could probably be dealt with by allowing arrays into the route in addition to raw actions, and interpreting arrays encountered in the route as multi-step actions. However, I'm going to work on other things before trying again to implement kicking.

paulkent-um commented 1 year ago

Addendum: I may soon be able to detect shopkeeper doors by checking for "Closed for inventory" engraved in the dust outside the door. This may make it viable to kick down locked doors as we find them, as long as the door doesn't have that label. However, leg injury and monster awakening are still risks associated with this approach.