Cite as
NetHack 3.6.7 source
Original
https://www.nethack.org/
Pinned
NetHack/NetHack @ ed600d9f0f3c37677418f0150f59363ca641f3dc
Accessed
2026-10-21
Licence
NetHack General Public License (dat/license, “Copyright 1989 M. Stephenson”); each file's header: “NetHack may be freely redistributed. See license for details.”
Credit
The NetHack DevTeam. File headers credit Stichting Mathematisch Centrum, Amsterdam (1985), with later copyrights such as Ken Arromdee's (extralev.c, 1988–89) and Robert Patrick Rankin's (2012).
Notes
The pin is the commit tagged NetHack-3.6.7_Released (“set patchlevel.h to release date (take 2)”); README: “NetHack 3.6.7 -- General information February 2023”. Game rules are in src/eat.c (hunger), src/uhitm.c (the hero's melee), src/mklev.c and src/extralev.c (levels), src/o_init.c (item descriptions), src/restore.c and src/end.c (saving and dying).

Cited on

Claims (12)

NetHack's README calls the game “a distant descendent of Rogue and Hack”.README L3–5Developer
NetHack 3.6.7 starts the hero at 900 nutrition. Once per game turn, and again for each melee attack the hero makes, it takes 1, unless the hero has slow digestion, is polymorphed into a form that doesn't eat, or is praying under divine protection, and only at a chance of 1 in 10 while the hero is asleep or fainted. On odd turns, regeneration (not from an artifact) and a Stressed or heavier load each take 1 more; on even turns, the Hunger property and Conflict (not from an artifact) do, and once every 20 turns each worn ring that has a charge other than 0 or takes none, the worn amulet, and carrying the Amulet of Yendor take 1 each.src/eat.c L116–120src/allmain.c L172–176src/allmain.c L281src/eat.c L2790–2804src/eat.c L2806–2841include/youprop.h L373include/hack.h L25src/pray.c L1873–1877src/hack.c L1975–1983src/uhitm.c L406–409Code
NetHack 3.6.7 counts the hero Satiated above 1,000 nutrition, Not Hungry above 150, Hungry above 50, Weak above 0, and Fainting at 0 or below. While Fainting, a hero not already fainted or helpless faints on entering the state, and later at a chance that grows as nutrition falls (1 in 20 at 0), for 10 turns plus a tenth of the deficit; on an update where neither happens, the hero starves once nutrition is below −(100 + 10 × Constitution).src/eat.c L2936–2939src/eat.c L2977–2999src/eat.c L3001–3008src/eat.c L2842Code
In NetHack 3.6.7, food that brings nutrition to 2,000 or more chokes a hero who was Satiated (for a meal, at its start). A hero who doesn't breathe always vomits and loses 1,000 nutrition instead; a hero being strangled always dies; any other hero vomits 1 time in 20 and otherwise dies.src/eat.c L2863–2865src/eat.c L2543src/eat.c L238–260Code
In NetHack 3.6.7 the hero's melee attack hits when a roll of 1 to 20 is below a total of 1 + Luck + the strength and dexterity bonus + the target's armor class + the hero's level (a polymorphed hero's monster level) + the hero's to-hit increment from rings of increase accuracy. The total gains 2 against a stunned, a fleeing, or a sleeping target (which the attack wakes), and 4 against one that can't move; it loses 3 while the hero is trapped and more for a heavier load; it adds the wielded weapon's to-hit and the hero's skill bonus, and adjusts for a monk and for an elf against an orc. An engulfed hero always hits. Computed, the chance is (total − 1) / 20, held within 0 to 100%. Damage is computed only after a hit.src/uhitm.c L266–267src/uhitm.c L275–291src/uhitm.c L293–322src/uhitm.c L612–613src/rnd.c L172src/uhitm.c L481–494src/weapon.c L889–894src/do_wear.c L980Code
Computed from both games' code, NetHack 3.6.7's melee roll keeps the rate of Rogue 5.4's swing: each point of the attacker's level or the target's armor class adds 5% to the chance to hit, which is (level + armor class + bonuses) / 20 in Rogue and (level + armor class + Luck + bonuses) / 20 in NetHack.src/uhitm.c L266–267src/uhitm.c L612–613src/rnd.c L172Code
An ordinary NetHack 3.6.7 level places rooms, one of which may be a vault, in free rectangles until none is left, a room fails to fit, or it has 40. It sorts them by left edge, and joins each to the next, stopping early at a chance of 1 in 50 per join. It then joins each room to the one two along when they aren't yet connected, then any pair still unconnected. With 3 or more rooms it makes 4 to (room count + 3) attempts at another corridor; an attempt gives up before digging when the square outside its door is already open, and stops short, leaving a dead end, at a chance of 1 in 35 per step.src/mklev.c L227–239include/global.h L330src/mklev.c L62–64src/mklev.c L700–704src/mklev.c L319–348src/mklev.c L294–295src/sp_lev.c L2248Code
NetHack 3.6.7's main dungeon, the Dungeons of Doom, holds one level built in Rogue's style. Its code's comment says “Rogue levels are structured 3 by 3, with each section containing a room or an intersection”, and each of the nine cells is an intersection at a chance of 1 in 5, so long as at least one room is made.dat/dungeon.def L17–21src/extralev.c L209–213src/extralev.c L228–243src/mklev.c L698–701Code
Restoring a NetHack 3.6.7 game deletes the save file once it is read, unless the game is in wizard (debug) or explore mode; in those modes the Unix build asks “Do you want to keep the save file?”. While a restore runs, the Unix build makes the file unreadable, to disallow parallel restores.src/restore.c L901–902sys/unix/unixmain.c L295sys/unix/unixmain.c L307–319Code
When a NetHack 3.6.7 hero dies in wizard (debug) or explore mode, from any cause of death from an ordinary death to genocide (not a panic, quitting, escaping, or ascending), and a worn amulet of life saving hasn't already saved the hero, the game asks “Die?”; answering no saves the hero's life and play goes on.src/end.c L1187–1194src/end.c L1168–1186include/hack.h L137–153Code
When a NetHack 3.6.7 game starts, it shuffles the descriptions of amulets, potions, rings, scrolls, spellbooks, wands, and venoms within each class, and of helmets, gloves, cloaks, and boots within each of those groups. Water keeps a fixed description, and scrolls, spellbooks, and amulets keep the unique or non-magic ones fixed; a type whose name is already known keeps its description.src/o_init.c L178–179src/o_init.c L243–266src/o_init.c L81–95src/o_init.c L208–221Code
When a NetHack 3.6.7 hero dies, unless a worn amulet of life saving or the wizard and explore modes' “Die?” prompt saves the hero, the game records the score and ends the program.src/end.c L1168–1201src/end.c L1618–1626Code