Live data from Hacker News

First NetHack bot ascension

reddit.com

61–70 of 89 posts

Re: First NetHack bot ascension

#61
post #54

Folks, do yourself a favor, and check out the bot's source: 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...

I 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 ( 15 (:xplvl (:player game))))) It makes zero intuitive sense to me.

Hi! Here's a few explaining words:

The first one is missing a whole bunch of context. But here's a start: The first thing inside parentheses is the operator/function, the rest are arguments/operands. This one is best viewed from the inside out, so... a method ending in a question mark is most likely a predicate, i.e. a true/false test returning a boolean. So we're testing for a weak player. Outside from there is an 'and', so we're looking to combine that test with another one (further to the right, that you didn't show). Maybe checking if the player is both weak and hungry, as that may mean he'll croak soon.

Every paren pair ('S-expression') in Lisp (err, Clojure) returns a value, so the "if" is not so much a control-flow construct as it's like C's ternary op: [ cond ? iftrue : iffalse ]. Its first argument will be a test, like that weak-hunger thing. Then you will have one or maybe two other arguments. The first is returned if the condition is true, the second one if false. There may not be a second argument, in which case the return value will be 'nil' or maybe 'false' - they're sorta equivalent anyway.

Finally, the "or" will evaluate and return its first subexpression if it's true, or also evaluate the second one if not and return that. You can actually have as many arguments to an "or" as you like - they will be short-circuit-evaluated until one of the arguments is true, or if you hit the right paren without finding a true, you'll get a 'false' ('nil' ?).

------------------------------------

The second example is a function definition. By convention, 'want-protection?' will be the name of a predicate, i.e. something that tests and returns true/false.

'game' is the single argument to that function. From usage later on, it looks to be a map, or you might think of it as an associative array, or a key-value mapping.

The first half tests whether the 'protection' value of the player, which itself is the 'player' value of the game (in C: game.player.protection, except those components are keys rather than fields) is less than (see the '<' operator on the left?) 3. The second half tests whether (I'm guessing) his experience level is greater than 15. The 'and' combines those, i.e. if he's at least a lvl 16 player and his prot value sucks at less than 3, he'll want protection (so return 'true').

Re: First NetHack bot ascension

#62
post #10
post #2

Reading through the comments, I realized that people even do speedruns in Nethack... impressive.

People do blindfolded runs of Mike Tyson's Punch Out! Which is also impressive.

People do ascend blindfolded characters in NetHack.

Such an ascension is aptly named "Zen Ascension".

http://nethackwiki.com/wiki/Zen#Notable_Ascensions

Re: First NetHack bot ascension

#63

I'm the creator of a Rogue-like game (Dead By Zombie) and love NetHack, consider it one of the masterpieces of game design I've tried to study and learn from. Lessons baked into it both in terms of game design and software. Has a lot of bang per buck, in terms of fun/value per LOC, and per square inch of screen real estate. If anybody gets introduced to Rogue-like UI for the first time because of this article, and li…

I'm one of those people who are just now taking a look at this genre. Can't believe how cool this is.

Re: First NetHack bot ascension

#64

Earlier quoted context omitted.

This 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.

* +5 safely. +7 is elven armor.

Ah right, thanks for the correction! (I bet you can guess how many G/SDSMs I've evaporated ;-) ... :'( ...)

Re: First NetHack bot ascension

#65
Really amazing achievement, kudos to duke-nh!

For those of you who are looking to get into nethack, or play it all the time... (shameless plug) I've been working on a project for some years that helps ease some of the monotony of playing.

https://github.com/samfoo/noobhack

For example, it keeps track of where you see shops, so you can come back, maps out levels and what you've seen on them, and auto-price identifies things you pick up.

There's a rudimentary plugin system so you can write your own extensions (more coming soon).

Re: First NetHack bot ascension

#66
post #30
post #14

Earlier quoted context omitted.

There are lots of advanced techniques for identifying things. If you have a pink potion you can throw it at a monster, and based on the monster's reaction you might now know what pink potions are. Most of this stuff would be hard to learn on your own though.

You can also identify rings by dropping them down wells—different rings fall down (or don't fall down) the wells in different ways—and identify wands by writing on the ground with them. Definitely hard to pick up any of that on your own, though.

I think you mean "sinks" instead of "wells" (there's at least one behavior in NetHack that's inspired by the name of the sink, and they were reputedly included in the game so that NetHack would contain "everything, including the kitchen sink").

Re: First NetHack bot ascension

#67
post #66
post #30

Earlier quoted context omitted.

You can also identify rings by dropping them down wells—different rings fall down (or don't fall down) the wells in different ways—and identify wands by writing on the ground with them. Definitely hard to pick up any of that on your own, though.

I think you mean "sinks" instead of "wells" (there's at least one behavior in NetHack that's inspired by the name of the sink, and they were reputedly included in the game so that NetHack would contain "everything, including the kitchen sink").

Good catch, my mistake. Thanks.

Re: First NetHack bot ascension

#68
post #55
post #51

Earlier quoted context omitted.

NetHacks 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/TheDevTeamThinksOfEver...

I lost it at this entry: > Additionally, throwing a cockatrice corpse up ( Some of these I knew, most I did not. Thanks for sharing that.

Oh 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.

Re: First NetHack bot ascension

#69
post #11

Earlier quoted context omitted.

It's incredibly complicated. That's probably less of a big thing now than it was in the 80s or 90s. In the 80s or 90s it was just amazing that a game could be that intricate. The sigil-based graphics are part of what make the complexity possible. And - the dev team have coded in all manner of combinations of things, many of which get you killed in plausible/amusing/annoying/complicated ways. There's a culture of play…

> The sigil-based graphics are part of what make the complexity possible I don't think that is relevant, I have played the GUI version for many years, and it's perfectly usable.

This is the reason those games can be so complex. Want to make a character fly 10m? Just move his character ('@') 10 grid steps. Want to make a camera? A char 'c' will do it. It's awesome that this allows you to easily program whatever you wish but you still get a visual representation of what's happening.
Post reply on HN