
First NetHack bot ascension - ivank
https://www.reddit.com/r/nethack/comments/2tluxv/yaap_fullauto_bot_ascension_bothack
======
statico
You can watch players (and bots) play NetHack in real time:

    
    
        telnet nethack.alt.org
    

...then hit "w" to watch games that are in progress. You might need to resize
your window, and some players might be using a different character set than
your terminal.

If you want to start playing, telnet there, create an account, hit "p" to play
a game and then "?" to read basic help.
[http://nethack.alt.org/](http://nethack.alt.org/) will keep logs of your game
as well as other stats.

This post also mentions previous bot attempts such as the Tactical Amulet
Extraction Bot (TAEB), which is also worth looking at:
[http://taeb.github.io/](http://taeb.github.io/)

Warning, SPOILERS: If you're okay with spoiling the game to some extent (e.g.,
solutions to common puzzles, which corpses are safe to eat, strategies), check
out the NetHackWiki:
[http://nethackwiki.com/wiki/Main_Page](http://nethackwiki.com/wiki/Main_Page)

~~~
mjgoins
It's worth pointing out that no one ever finishes (ascends) a game of Nethack
without looking at the spoilers, so they're really not spoilers, they're more
like the instruction manual.

It is definitely more fun to try playing the game for several hours without
reading the spoilers, but you're not going to figure out stuff like the
Invocation Ritual without reading the spoilers.

~~~
schoen
There is at least one self-described unspoiled ascension, in 2010:

[https://groups.google.com/forum/#!topic/rec.games.roguelike....](https://groups.google.com/forum/#!topic/rec.games.roguelike.nethack/wci4E96iKc4)

This did involve use of wizard mode (not for the unspoiled ascension itself,
but beforehand for learning stuff).

People often ask how someone would learn how to perform the Invocation without
spoilers. One intended answer by the DevTeam is to pay the Oracle for a series
of major consultations, one of which (somewhat elliptically) explains the
Invocation. The Oracle consultations aren't considered spoilers if you pay for
them in-game.

------
jashkenas
Folks, do yourself a favor, and check out the bot's source:
[https://github.com/krajj7/BotHack/blob/master/src/bothack/bo...](https://github.com/krajj7/BotHack/blob/master/src/bothack/bots/mainbot.clj)

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

~~~
aw3c2
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 (< (:protection (:player game)) 3) (> 15 (:xplvl (:player game)))))
    

It makes zero intuitive sense to me.

~~~
schoen
That 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%2...](https://en.wikipedia.org/wiki/Lisp_%28programming_language%29)

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

------
jedberg
At the risk of losing my nerd card, I've never played Nethack.

I read the reddit thread, and while it was in English, it made not a lick of
sense to me. Now I know how non-engineers feel sometimes. :)

BTW, can someone tell me why this is such an amazing accomplishment? I know
Nethack is very old, so is this a case of a complex problem space or just no
one has tried before?

~~~
cturner
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 players looking at the source code while they play. The
source is really antiquated C.

If you decide to have a go, I'd recommend printing out a copy of the manual,
avoiding the spoilers for the first couple of dozen games at least. Just try
to learn your way around the dungeon just from that manual, and experience the
complexity and sense of mystery.

It's not a particularly 'good' game - grindy. A vogue at the moment in
roguelikes is for games with as little complexity as possible. For example,
I've spent far more time studying the C code to this game than I have playing
it:
[http://trogrd.tumblr.com/post/61949503427/zoo](http://trogrd.tumblr.com/post/61949503427/zoo)

~~~
riffraff
> 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.

~~~
darkmighty
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.

~~~
WildUtah
An Expansive Camera in Nethack is the character '(', not a letter 'c'.

A letter 'c' is a cockatrice or a pyrolisk; those are both quite dangerous so
I suggest you learn to recognize them for your own good.

------
jere
If you find this interesting, take note that people were writing bots to beat
_Rogue_ over 30 years ago:
[http://en.wikipedia.org/wiki/Rogue_(video_game)#Automated_pl...](http://en.wikipedia.org/wiki/Rogue_\(video_game\)#Automated_play)

~~~
otakucode
The roguelike Angband has had a bot built into it for at least 20 years... I
don't know that it has ever actually beat the game, though. I used to run it
as a screensaver on, I think, Windows 95. Was interesting to watch, but it
wasn't a terribly clever bot.

------
bkcooper
Good stuff.

There's a bot with several wins in Dungeon Crawl Stone Soup, another
roguelike. The combinations it has won are pretty rote, but it's still very
impressive, particularly since I don't think it's even capable of knowing that
much about the game (it uses Lua handles to pick up information about the
state and I believe there's a fair chunk of the game that isn't exposed that
way.)

------
riffraff
> the bot has already managed to reach Rodney without farming and can get to
> the Castle and beyond fairly reliably, maybe 1 in 10 runs or so

so, the bot is also a better player than me.

------
guelo
One of the difficulties for a human playing Nethack is remembering all the
potions and amulets and wands and scrolls and rings and monsters and their
effects and many, many, many combinations. In a way a bot should have an
easier time since it has basically unlimited memory.

~~~
samspot
True, also most player deaths are due to obvious mistakes - YASD (Yet Another
Stupid Death), mistakes that the bot will only ever make once and then be
programmed to avoid.

~~~
schoen
Yeah, I guess a major advantage for a bot is being totally disciplined and
never impatient. "No, I won't read that yet; yes, I will #untrap three times;
no, I won't go down these stairs with the cockatrice corpse; no, I won't eat
this giant while satiated" and so on. It can be hard for human players to have
absolute discipline about not doing actions that they know could theoretically
cause instant death.

Also, the bot can safely walk along the edge of lava without falling in due to
a typo. :-)

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

~~~
pdpi
Why is it surprising? (And I do not at all mean that in a snarky tone. I've
been lurking in the nethack community for so long that it seems perfectly
natural to me)

~~~
kbenson
Probably because to the the person familiar enough with NetHack to have played
it but never immersed themselves in the community, ascension seems _hard_. A
speedrun is one thing, doing it on a game many can't even win is another thing
entirely.

~~~
pmontra
I add to the point: doing it on a game many can't even make half way through.

~~~
nkuttler
My first nethack game? I was locked in a room without door and was killed by a
falling rock. I don't even know why I ever played another game :-) And yes,
there was a big gap until the next game. As a beginner that's all you ever do,
die, die, die.

~~~
klibertp
Similar experience with ADOM, it even has a special location which becomes
reachable only after the game killed your 100th hero. Got to this point in a
few days back then, I wish there was something good for 1000th death, that was
when I started to know what I'm doing :)

------
samfoo
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](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).

------
fjarlq
Video of the winning game:
[https://www.youtube.com/watch?v=unCQHAbGsAA](https://www.youtube.com/watch?v=unCQHAbGsAA)

The author's list of milestones illustrates the key components of this
achievement, as well as some limitations:

[https://github.com/krajj7/BotHack#milestones-
reached](https://github.com/krajj7/BotHack#milestones-reached)

Awesome work, Jan Krajicek!

------
nkuttler
That is truly impressive. I remember what a colossal achievement my first
ascension felt like. Nethack is such a complex game, but the most important
skill is probably patience and planning single moves, something a bot can be
perfect or very good at. Now I feel like playing again.

~~~
ansible
The bot can also do things that would bore a human player to tears, such as
automatically switching between items as the need arises.

~~~
nkuttler
Not to mention the farming. I could never do that.

~~~
schoen
I look forward to hearing about a non-farming bot ascension (as the developer
of this bot has suggested is possible!).

------
mkramlich
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 likes it, I also recommend checking out Dwarf Fortress. Similar
but very very different in ways that people tend to either love or hate.

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

