Cite as
Rogue 5.4.4 source
Original
https://github.com/Davidslv/rogue
Pinned
Davidslv/rogue @ cf9bd26d564a72fac4cf56b55c96c2435270d29a
Accessed
2026-10-21
Licence
BSD 3-clause (LICENSE.TXT): “Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman”. state.c and mdport.c carry Nicholas J. Kisseberth's BSD license, and xcrypt.c David Burren's.
Credit
Rogue by Michael Toy, Glenn Wichman, and Ken Arnold. The 5.4.4 release is the rogueforge port (vers.c: “rogue (rogueforge) 09/05/07”), whose save code (state.c) and portability layer (mdport.c) are Nicholas J. Kisseberth's. Mirrored on GitHub by David Silva.
Notes
The pin is the commit tagged 5.4.4 (“Rogue - version 5.4.4”); vers.c sets release = "5.4.4". This is Rogue 5.4, not the 1980 original, whose code isn't public. Game rules are in daemons.c (hunger), fight.c (combat), rooms.c and passages.c (levels), init.c (item names), and save.c (restoring).

Cited on

Claims (12)

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.fight.c L378–384main.c L186–189Code
Rogue 5.4 starts the hero with 1,300 food. The stomach daemon runs once per pass of the command loop, after the hero's move, or after both moves when the hero is hasted. While food is above 0 it takes 1, plus each worn ring's cost, and 1 less while the hero carries the Amulet of Yendor, so with the Amulet and no rings the count stops.init.c L29rogue.h L117main.c L150command.c L32–39command.c L444daemons.c L160–163pack.c L147–148Code
In Rogue 5.4 each worn ring adds to the turn's food cost by kind: 2 for regeneration; 1 for protection, add strength, sustain strength, stealth, or maintain armor; 1 at a chance of 1 in 3 for searching, dexterity, or increase damage, and 1 in 5 for see invisible; 0 for adornment, aggravate monster, or teleportation. A ring of slow digestion gives 1 back at a chance of 1 in 2.rings.c L163–179Code
Rogue 5.4 shows Hungry once food drops below 300 and Weak below 150. At 0 or below, rings stop counting and food drops by 1 a turn; on each turn the hero isn't already helpless, a 1-in-5 chance faints the hero for 4 to 11 turns, and the hero starves once the count is below −850.rogue.h L118–120daemons.c L144–159daemons.c L165–179io.c L182–185main.c L186–189Code
Eating any food in Rogue 5.4 first raises a negative count to 0, then adds 1,100 to 1,499 (HUNGERTIME - 200 + rnd(400)), capped at 2,000.misc.c L296–300rogue.h L119Code
In Rogue 5.4 an attack hits when rnd(20), a roll of 0 to 19, plus a to-hit bonus is at least 20 less the attacker's level less the defender's armor class. The bonus is the weapon's plus (with a fired missile's launcher plus, and the hero's dexterity rings when the weapon used is the hero's wielded one), the attacker's strength adjustment, and +4 when the target isn't running (asleep or held); a hero defender's armor class is the worn armor's, when the hero wears any, less any rings of protection. Computed, the chance is (level + armor class + bonus) / 20, held within 0 to 100%. Damage is rolled only after a hit.fight.c L378–384fight.c L411–433fight.c L438–453fight.c L460–470main.c L186–189Code
Computed from swing, a level-1 Rogue 5.4 hero at strength 16 with a +1 weapon hits a monster of armor class 7 45% of the time while it is running, and 65% while it is asleep or held.fight.c L378–384fight.c L46–49fight.c L442–443Code
Rogue 5.4 lays out each level as nine boxes in a 3 by 3 grid over the 80 by 24 screen. It first marks 0 to 3 boxes, picked at random and possibly the same twice, as gone: a gone box gets a point for corridors to meet but no room. Each other box gets a room; it is dark when a roll of 0 to 9 is below the depth less 1, and a dark room is a maze at a chance of 1 in 15.rogue.h L22rogue.h L30–31rooms.c L41–42rooms.c L55–57rooms.c L61–82rooms.c L86–91passages.c L169–183Code
Rogue 5.4 joins the boxes with corridors only between grid neighbors: from a random box it grows a tree, each step joining a random neighbor not yet joined, until all nine are connected, and then makes 0 to 4 tries at an extra corridor between a random box and a neighbor it isn't joined to.passages.c L33–43passages.c L55–95passages.c L97–115Code
Restoring a Rogue 5.4 game deletes the save file as soon as it is read, refuses a file with another hard link or reached through a symbolic link, “to defeat multiple restarting from the same place”, and refuses a saved hero with no hit points left. It then reseeds the random number generator from the process id. A wizard in a debug (MASTER) build skips the deletion and the link check.save.c L222–229save.c L237–248save.c L250–255save.c L262Code
At the start of each game, Rogue 5.4 gives each of its 14 kinds of potion a different color, drawn at random from a list of 27 (amber to yellow), and each of its 18 kinds of scroll a title of 2 to 4 random words, each word 1 to 3 syllables from a fixed list, up to about 40 characters.main.c L118–119init.c L81–111init.c L240–253init.c L260–289rogue.h L219rogue.h L242Code
When a Rogue 5.4 hero dies, death shows the tombstone (or, with the tombstone option off, one line naming the killer), records the score, waits for return, and exits the program.rip.c L228rip.c L240–246rip.c L270–274main.c L391–395Code