NetHack statistics

by Fish-Face at 2:09 p.m. on 27. October, 2013

I've recently been playing NetHack on the server and was wondering how likely you are to ascend depending on how long you survive. If you don't know, NetHack is a notoriously difficult game, and few people ever beat it (or "ascend" as it's known.) However, the greatest difficulties occur in the early game, when not just mistakes will get you killed, but also the foibles of the Random Number Generator (or the Random Number God as s/he is sometimes called.) So with the help of's extended log, documenting over 2.3 million plays of the game, ipython and matplotlib, I cooked up the following graph:

NetHack Chances
NetHack Chances

This graph shows your chance of ascending based on how long you survive in the dungeon, clearly demonstrating that the longer you survive, the better your chances. Notice though, that it never gets that certain: no matter how long you survive, it's possible to fall from glory (or, "Splat".) As the turns go on, fewer and fewer people have survived without already ascending, and the graph gets jagged and unreliable.

But what exactly is happening to our 2.3 million adventurers over the 100,000 turns graphed here? Time for more graphs:

NetHack statistics
NetHack statistics

On the left, we see the number of players dying, quitting or ascending on each turn, on two different scales: Firstly at a large scale (but still not nearly including the vast numbers of people who quit or die immediately!) for the first 5,000 turns and then zoomed in up to 50,000 turns. Both graphs have been smoothed. Note that of the 920,000 "deaths" on the first turn, almost all are due to escaping the dungeon.

On the right, we look at how many players there are of each status (alive, ascended, dead, quit) after a number of turns. On the first graph you can see that the tiny quantity of ascensions barely even features, while in the zoomed-in graph you can see how the ascensions begin to accumulate. Since many many people quit on the first turn (either by #quitting or escaping) we have excluded them from these graphs.

Here's the code I used to gather statistics on the xlogfile:

import re
from numpy import *

def movingaverage(interval, window_size):
    window = ones(int(window_size))/float(window_size)
    return convolve(interval, window, 'same')

l = 100000
r = re.compile(':death=(?P<death>[^:]+).*:turns=(?P<turns>[0-9]+)')
total = 2361141 #Total number of records with extended data available

def parse():
    global dies, quits, asc, alive, alive_asc, alive_asc_quit
    dies = [0] * l
    quits = [0] * l
    asc = [0] * l

    for line in open('xlogfile.full.txt', 'r'):
        m =
        if m:
            turns = int('turns'))
            if turns >= l:
            if'death') == 'quit':
                quits[turns] += 1
            elif'death') != 'ascended':
                dies[turns] += 1
                asc[turns] += 1

cumtotal = total - dies[1] - quits[1]
alive_asc_quit = cumtotal - cumsum(dies[2:])
alive_asc = alive_asc_quit - cumsum(quits[2:])
alive = alive_asc - cumsum(asc[2:])

Now back to 'hacking!

Related tags: graphs ipython nethack numpy python statistics


said at 2 p.m. on 2. May, 2019 (2 months ago)

What's up, after reading this amazing piece of writing i am too cheerful to share my knowledge here with friends.

For most recent information you have to visit
world wide web and on world-wide-web I found this website as a best web site for latest updates.

said at 6:56 p.m. on 4. May, 2019 (1 month ago)

Wow, that's what I was seeking for, what a stuff! existing here at this web site,
thanks admin of this web page.

What a stuff of un-ambiguity and preserveness of precious
familiarity on the topic of unpredicted emotions.

said at 8:56 a.m. on 12. May, 2019 (1 month ago)

I have learn several good stuff here. Definitely value bookmarking for revisiting.

I surprise how much effort you place to make this sort of wonderful
informative website.

Hi there just wanted to give you a quick
heads up. The words in your article seem to be running off the screen in Opera.
I'm not sure if this is a format issue or something to do with browser compatibility but I thought I'd post
to let you know. The layout look great though! Hope you get the problem resolved soon. Many

hello!,I like your writing so a lot! percentage
we be in contact more approximately your post on AOL?
I require an expert on this space to solve my problem. Maybe that's you!

Taking a look ahead to peer you.

I know this website presents quality depending posts and extra stuff, is there any other web page which provides these kinds
of stuff in quality?

Hey there, You've done an incredible job.
I will definitely digg it and personally suggest to my friends.
I'm sure they will be benefited from this web site.

Pretty nice post. I just stumbled upon your blog and wanted to say that
I have truly loved surfing around your blog posts. In any case
I'll be subscribing to your rss feed and I am hoping you write again very soon!

Excellent post! We will be linking to this particularly great article on our site.
Keep up the good writing.

I'm gone to say to my little brother, that he should also pay a visit this
web site on regular basis to obtain updated from most recent reports.

I read this paragraph completely about the resemblance of most up-to-date and earlier technologies, it's amazing

Attractive element of content. I simply stumbled upon your web site and in accession capital to assert that
I get actually enjoyed account your weblog posts.

Any way I will be subscribing in your feeds and even I success you get admission to persistently quickly.

Howdy, i read your blog occasionally and i own a similar one and
i was just wondering if you get a lot of spam responses?
If so how do you protect against it, any plugin or anything you can suggest?
I get so much lately it's driving me insane so any help is very much appreciated.

Hi my friend! I wish to say that this article is awesome,
nice written and come with almost all vital infos.

I would like to peer more posts like this .

Do you mind if I quote a few of your articles as long as
I provide credit and sources back to your weblog? My website is in the
exact same area of interest as yours and my users would certainly
benefit from a lot of the information you present here.
Please let me know if this ok with you. Many thanks!

Hi there, after reading this remarkable post i am as well
glad to share my knowledge here with mates.

I'm really enjoying the theme/design of your web site.

Do you ever run into any internet browser compatibility issues?
A small number of my blog readers have complained about my
website not working correctly in Explorer but looks great
in Firefox. Do you have any tips to help fix this issue?

If you wish for to grow your familiarity just keep visiting this site and be updated with the latest news
posted here.

Have you ever thought about including a little bit more than just your articles?
I mean, what you say is important and all.

But think about if you added some great images or videos to give your posts more,
"pop"! Your content is excellent but with pics and clips, this site could certainly be one of the most beneficial in its field.
Amazing blog!

I could not refrain from commenting. Well written!

quest bars cheap
said at 2:21 a.m. on 15. June, 2019 (yesterday at 02:21)

Appreciation to my father who told me regarding this web site,
this web site is really amazing.

quest bars
said at 4:07 p.m. on 16. June, 2019 (6 hours ago)

My partner and I stumbled over here by a different page and thought
I might as well check things out. I like what I see so
now i am following you. Look forward to checking out your web page again.