<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://nethackwiki.com/index.php?action=history&amp;feed=atom&amp;title=User%3AProwler%2FMonster_difficulty_and_experience_calculation</id>
	<title>User:Prowler/Monster difficulty and experience calculation - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://nethackwiki.com/index.php?action=history&amp;feed=atom&amp;title=User%3AProwler%2FMonster_difficulty_and_experience_calculation"/>
	<link rel="alternate" type="text/html" href="https://nethackwiki.com/index.php?title=User:Prowler/Monster_difficulty_and_experience_calculation&amp;action=history"/>
	<updated>2026-06-04T02:19:13Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.5</generator>
	<entry>
		<id>https://nethackwiki.com/index.php?title=User:Prowler/Monster_difficulty_and_experience_calculation&amp;diff=205018&amp;oldid=prev</id>
		<title>Prowler: Created page with &quot;This is how I recalculated the table in Monster difficulty page:  First, I patched the game so that instead of starting normally it would print the raw table with experien...&quot;</title>
		<link rel="alternate" type="text/html" href="https://nethackwiki.com/index.php?title=User:Prowler/Monster_difficulty_and_experience_calculation&amp;diff=205018&amp;oldid=prev"/>
		<updated>2026-05-31T18:32:37Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This is how I recalculated the table in &lt;a href=&quot;/wiki/Monster_difficulty&quot; title=&quot;Monster difficulty&quot;&gt;Monster difficulty&lt;/a&gt; page:  First, I patched the game so that instead of starting normally it would print the raw table with experien...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This is how I recalculated the table in [[Monster difficulty]] page:&lt;br /&gt;
&lt;br /&gt;
First, I patched the game so that instead of starting normally it would print the raw table with experience values calculated under the assumption that monster level is equal to its base level:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -u &amp;lt;&amp;lt;EOF&lt;br /&gt;
diff --git a/sys/unix/unixmain.c b/sys/unix/unixmain.c&lt;br /&gt;
index eca90d463..613baa905 100644&lt;br /&gt;
--- a/sys/unix/unixmain.c&lt;br /&gt;
+++ b/sys/unix/unixmain.c&lt;br /&gt;
@@ -65,6 +65,20 @@ main(int argc, char *argv[])&lt;br /&gt;
 &lt;br /&gt;
     early_init(argc, argv);&lt;br /&gt;
 &lt;br /&gt;
+    {&lt;br /&gt;
+        int i;&lt;br /&gt;
+        struct monst mon;&lt;br /&gt;
+        memset(&amp;amp;mon, 0, sizeof(mon));&lt;br /&gt;
+        gy.youmonst.data = &amp;amp;mons[PM_HUMAN];&lt;br /&gt;
+        for (i = 0; i &amp;lt; NUMMONS; i++) {&lt;br /&gt;
+            mon.data = &amp;amp;mons[i];&lt;br /&gt;
+            mon.m_lev = mons[i].mlevel;&lt;br /&gt;
+            printf(&amp;quot;%s\t%d\t%d\n&amp;quot;, mons[i].pmnames[NEUTRAL],&lt;br /&gt;
+                   mons[i].difficulty, experience(&amp;amp;mon, 0));&lt;br /&gt;
+        }&lt;br /&gt;
+        exit(0);&lt;br /&gt;
+    }&lt;br /&gt;
+&lt;br /&gt;
 #if defined(__APPLE__)&lt;br /&gt;
     {&lt;br /&gt;
 /* special hack to change working directory to a resource fork when&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This patch was applied against tag NetHack-5.0.0_Release, commit 16ff59115315917b93185d026aeefea06db9b0f4.&lt;br /&gt;
&lt;br /&gt;
I also wrote a python script for converting the output into the wiki table format. Piping the output of the patched game into it produces text that's ready for pasting into the wiki page:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env python&lt;br /&gt;
&lt;br /&gt;
import sys&lt;br /&gt;
&lt;br /&gt;
EXCLUDED = (&lt;br /&gt;
    'long worm tail',&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
PLAYER_MONSTERS = (&lt;br /&gt;
    'valkyrie',&lt;br /&gt;
    'tourist',&lt;br /&gt;
    'samurai',&lt;br /&gt;
    'rogue',&lt;br /&gt;
    'knight',&lt;br /&gt;
    'barbarian',&lt;br /&gt;
    'archeologist',&lt;br /&gt;
    'wizard',&lt;br /&gt;
    'ranger',&lt;br /&gt;
    'cleric',&lt;br /&gt;
    'healer',&lt;br /&gt;
    'cave dweller',&lt;br /&gt;
    'monk',&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
MONSTER_PARENTHESIZED = (&lt;br /&gt;
    'Oracle',&lt;br /&gt;
    'sergeant',&lt;br /&gt;
    'human',&lt;br /&gt;
    'elf',&lt;br /&gt;
    'dwarf',&lt;br /&gt;
    'gnome',&lt;br /&gt;
    'orc',&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
def wiki_format_name(name):&lt;br /&gt;
    if name in ('Pestilence', 'Famine', 'Death'):&lt;br /&gt;
        return f'[[Riders#{name}|{name}]]'&lt;br /&gt;
    elif name in MONSTER_PARENTHESIZED:&lt;br /&gt;
        return f'[[{name.capitalize()} (monster)|{name}]]'&lt;br /&gt;
    elif name in PLAYER_MONSTERS:&lt;br /&gt;
        return f'[[{name.capitalize()} (player monster)|{name}]]'&lt;br /&gt;
    elif name == 'acolyte':&lt;br /&gt;
        return '[[Acolyte (quest guardian)|acolyte]]'&lt;br /&gt;
    return f'[[{name}]]'&lt;br /&gt;
&lt;br /&gt;
if __name__ == '__main__':&lt;br /&gt;
    table = []&lt;br /&gt;
    for line in sys.stdin:&lt;br /&gt;
        name, difficulty, xp = line.strip().split('\t')&lt;br /&gt;
        if name not in EXCLUDED:&lt;br /&gt;
            table.append([name, int(difficulty), int(xp)])&lt;br /&gt;
&lt;br /&gt;
    table.sort(reverse=True, key=lambda x: (x[1], x[2], x[0]))&lt;br /&gt;
&lt;br /&gt;
    print('{|class=&amp;quot;prettytable sortable striped&amp;quot;')&lt;br /&gt;
    print('!Name')&lt;br /&gt;
    print('!Experience')&lt;br /&gt;
    print('!Difficulty')&lt;br /&gt;
    for name, difficulty, xp in table:&lt;br /&gt;
        print('|-\t')&lt;br /&gt;
        print(f'|{wiki_format_name(name)} ||\t{xp}\t||\t{difficulty}')&lt;br /&gt;
    print('|}')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Prowler</name></author>
		
	</entry>
</feed>