4 ms·
Folks, do yourself a favor, and check out the bot's source: https://github.com/krajj7/BotHack/blob/master/src/bothack/bots/mainbot.clj https://github.com/krajj7
by jashkenas 12y ago
Folks, do yourself a favor, and check out the bot's source: https://github.com/krajj7/BotHack/blob/master/src/bothack/bots/mainbot.clj https://github.com/krajj7/BotHack/blob/master/src/bothack/bo...
It's really, really neat. Even to those of us who know little or nothing about the game, from the nested Englishy descriptors piled up into short conditions for things-the-bot-might-want-to-do, the basic strategies can be discerned...
- pavel_lishin 12y ago... and then there's some things that probably only make sense if you're very familiar with Nethack: (def desired-shirt (ordered-set "T-shirt" "Hawaiian shirt"))
- jballanc 12y agoThis one's actually not that hard to explain. Shirts can be worn under your armor, and these are the only two kinds of shirts. Normally, a shirt adds nothing to your armor class, but it can be enchanted (up to +7 safely), so it's nice to have one if you can find one. The problem with the Hawaiian shirt is that shop keepers will assume you're a tourist, and charge you extra.
- pavel_lishin 12y ago> The problem with the Hawaiian shirt is that shop keepers will assume you're a tourist, and charge you extra. Absolutely cannot tell if you're fucking with me, or if this is an actual game mechanic - and if so, why this shirt would be desirable.
- jubalfh 12y agoIt's usually not a first choice, but the tourist starts the game wearing it.
- TheCraiggers 12y ago> Absolutely cannot tell if you're fucking with me, or if this is an actual game mechanic Welcome to the world of nethack! The amount of special case situations that have been programmed into this game over the last few decades are truly amazing. (Mostly because it somehow still works.) I still remember the first time I ran into a kitchen sink.
- digi_owl 12y agoNow that is one hell of a in joke...
- jsheard 12y agoNetHacks DevTeam are so famous for their special cases that the TVTropes article for obscure special cases was named after them. Here's the subarticle for NetHack examples: http://tvtropes.org/pmwiki/pmwiki.php/TheDevTeamThinksOfEverything/NetHack http://tvtropes.org/pmwiki/pmwiki.php/TheDevTeamThinksOfEver...
- TheCraiggers 12y agoI lost it at this entry: > Additionally, throwing a cockatrice corpse up (<) will result in it hitting you on the head and, unless you're wearing a helmet, petrifying you instantly. Cause of death? "Petrified By Elementary Physics" Some of these I knew, most I did not. Thanks for sharing that.
- wfn 12y agoOh my, there's some really magnificent stuff, I started giggling while reading this: The Quantum Mechanic monster is basically one big physics joke. Its attack will randomly teleport you, and eating a Quantum Mechanic corpse will give you the intrinsic speed ability (or remove intrinsic speed from you if you were already fast). Upon death, the Quantum Mechanic also has a small chance to drop a box. When you open the box, a cat named Schrodingers Cat will be found inside. 50% of the time, the cat will be alive, and 50% of the time, the cat will be dead. What brings this into The Dev Team Thinks of Everything territory is that if you look at the game's source code, you discover that unlike every other box in the game, the state of the box's contents (whether the cat is alive or dead) is not determined until you open the box and look.
- Natsu 12y agoHe's not kidding, actually. This is why enchanted t-shirts are preferred for a little extra AC under your normal armor.
- AndyKelley 12y ago* +5 safely. +7 is elven armor.
- jballanc 12y agoAh right, thanks for the correction! (I bet you can guess how many G/SDSMs I've evaporated ;-) ... :'( ...)
- aw3c2 12y agoI have no idea how to even parse this: (or (if (and (weak? player) If it is a player or a weak player? Or this probably simple function(?): (defn- want-protection? [game] (and (< (:protection (:player game)) 3) (> 15 (:xplvl (:player game))))) It makes zero intuitive sense to me.
- lmm 12y agoLISP-style languages are a pain to read, but it's purely mechanical: everything's in "polish notation", (function arg1 arg2), even when function is something that we would want to think of as an operator or an accessor method. So in Scala I'd write that function as: def want-protection(game) = game.player.protection < 3 && game.player.xplvl < 15
- deleted 12y ago[deleted]
- schoen 12y agoThat first line is just the beginning of a statement that goes on until line 71. It decides whether to eat or pray if the player is very hungry. (In NetHack you can die of starvation if you don't have enough nutrition; nutrition can be obtained either by eating food[1], or in some circumstances by praying when hungry.) The second function is easier for me to understand: it says that the player wants protection if the player has less than 3 intrinsic protection and has an experience level higher than 15. (In NetHack, gods grant intrinsic protection under some circumstances, which causes one to become better armored even without wearing additional physical armor. It's basically like a kind of magical armor on one's body that's independent of any physical object.) The idea seems to be that a player with at least experience level 15 ought to have 3 or more points of protection, and if the player doesn't, the player should try to go and get them. If you're not used to reading parenthesized prefix notation, you might have a look at https://en.wikipedia.org/wiki/Polish_notation https://en.wikipedia.org/wiki/Polish_notation https://en.wikipedia.org/wiki/S-expression https://en.wikipedia.org/wiki/S-expression https://en.wikipedia.org/wiki/Lisp_%28programming_language%29 https://en.wikipedia.org/wiki/Lisp_%28programming_language%2... [1] In another example of NetHack's complexity, it's also possible in some circumstances to eat objects other than food, by turning into a monster that's able to eat the objects in question.