Jay Fenlason's Hack
Hack is a roguelike role-playing game written by Jay Fenlason, with contributions from Kenny Woodland, Mike Thome and Jon Payne, from which all subsequent versions of Hack and all versions of NetHack are descended. Jay Fenlason's Hack is the term given to the original Hack, without the extensive modifications by Andries Brouwer which are present in the more widely distributed version.
At present, source code for the original is not available online. A DOS port with user interface changes is available in binary form, all of Brouwer's versions are available as source code, and the source code for an early variant dubbed "PDP-11 Hack", which was based on a leaked early draft of Andries Brouwer's version, is also available.
- 1 Background
- 2 Variants
- 3 Principal differences from Andries Brouwer's Hack
- 4 Special room types
- 5 Mazes
- 6 Bestiary
- 7 Available Objects
- 8 References
Development began shortly after the 1982 USENIX conference in Boston, MA where the Michael Toy and Ken Arnold (the authors of the then closed-source Rogue) spoke. In Fenlason's own words:
- "I was curious about some of the game play issues involved in designing it, things like how the rooms and corridors were generated, so I started hacking up some random level generators and stuff to try things out. Someone looked over my shoulder and said, 'what's that?' So I sort of explained and they said, 'oh, that's cool; when do we get to play it?' " -- 
The only publication of the original Hack was on a USENIX software distribution tape, apparently the first 1984 USENIX tape (of which no online copy is known to exist), where it accompanied Jon Payne's text editor JOVE. It proved to be very popular:
- "Usenix had biannual meetings, Unix users would get together and swap war stories. For each meeting they'd put together a tape of some of the contributed software. I put [Hack] on the tape and forgot about it until someone I know mentioned that the two most popular pieces of software on that particular tape were my silly game and my friend Jonathon's text editor. Since then there's been several different versions of Hack written, and I think I'm the only person who still uses that text editor." -- 
The exact content of the original Hack is not known for sure (but see the comments section of this post for a possible lead). Three derivatives are known to exist. The rest of this article covers mainly PDP-11 Hack and "hack121".
"Hack121" (Hack 1.21 for DOS)
It refers to itself as version "1.21 (Slak was here!)", "Slak" apparently being Jay Fenlason himself; nonetheless, some changes have clearly been made by the porter (IBMgraphics and the fusion of mklev into hack).
See this newsgroup posting for a possible lead as to who ported it.
No source code for this program is known to exist, and it is not known for sure if the porter made any modifications which affect gameplay. Nonetheless, it is probably the closest to the original that is known to be extant.
PDP-11 Hack and PC/IX Hack
PDP-11 Hack (so-called, although it appears to require a nonstandard compiler, whereas it can be compiled on some later UNIX systems such as 4.2BSD without much work) is a variant developed by Michiel Huisjes and Fred de Wilde at the Free University (VU) in Amsterdam† (apparently based upon a early draft of Andries Brouwer's Hack, which was copied from his user area without his permission) and published on Usenet in February 1985. A port of this to a Unix clone called PC/IX (with a slightly different set of potions) was published in May by "peterb at pbear".
† It is possible that the compiler used was a contemporary version of the Amsterdam Compiler Kit, which dates from the early 1980s and which was developed at the VU.
The developers summarise their changes, in the PDP-11 Hack readme, as:
- "One of the main problems of Hack is its size. If you add about 1000 bytes of text more, your text segment will be to big. Therefore we saved text wherever this was possible. We removed the function fscanf(), and made the record file binary. To show the contents, use the program show (with flag -r).
- "Some additions we (Fred de Wilde and Michiel Huisjes) made are
- - The Vault
- - The Swamp
- - The Zoo
- - The Graveyard
- - Maxlevel = 40
- - Proper Saving
- - Several bugs
- - And many, many more..."
"Proper saving" references the fact that saving was apparently broken in the sources that they originally obtained (as they mention in comments in the corresponding code).
PDP-11 Hack incorporates a time restriction preventing playing on working hours on weekdays, which grants exceptions for the developers' UIDs, and which is removed in the PC/IX version.
The shar files of both versions are archived at Google Groups at:
- PDP-11 Hack
- PC/IX Hack
Principal differences from Andries Brouwer's Hack
- The concept of a role was introduced in Hack 1.0, and is not present in the other versions. Hack121 begins with a screen from which the player may buy equipment, this is mentioned by Robert Grover as a feature of Fenlason's original version. Brouwer presumably removed this screen fairly early on: PDP-11 Hack, being derived from an early draft of Andries Brouwer's Hack, starts the player off as a generic fighter character.
- The exact goal of the adventurer is uncertain. The Amulet of Yendor is not mentioned.
- Hack121 does not have pets. PDP-11 Hack starts the player off with a little dog, suggesting that pets were a relatively early addition by Brouwer.
Special room types
It seems likely that shops were the only special room type in Fenlason's original code.
Hack121 has shops. No other special room types are presently known to exist in hack121.
PDP-11 Hack has shops (mkshop), zoos (mkzoo), graveyards (mkyard), swamps (mkswamp) and vaults (mk_knox). The developers of PDP-11 Hack, per their readme, implemented vaults, swamps, zoos and graveyards themselves, leaving shops as the only roomtype which was present in the sources they originally obtained. Vaults, in particular, are implemented very differently to Hack 1.0.
Hack 1.0 has vaults (not delegated), shops (mkshop) and zoos (mkzoo).
PDP-11 Hack appears to contain Fenlason's team's original makemaz() implementation, given this source code comment, which does not appear in the refactored version of the function appearing in Hack 1.0, and appears to reference Kenny Woodland by his first name:
/* This is all Kenny's fault. He seems to have his x and y reversed */
The bestiaries of hack121 and PDP-11 Hack are listed below, along with the Hack 1.0 bestiary for comparison. Other monster descriptions may be lurking in other parts of the hack121 binary; therefore, this list cannot be considered as necessarily the final word for that version.
Main monster list
These are given in the order of their appearance in the code; it will be seen that the lists are quite similar.
|Hack121||PDP-11 Hack||Hack 1.0|
|bat (b)||bat (B)||bat (B)|
|lizard (l)||gnome (G)||gnome (G)|
|goblin (g)||hobgoblin (H)||hobgoblin (H)|
|jackal (j)||jackal (J)||jackal (J)|
|kobold (k)||kobold (K)||kobold (K)|
|pickpocket (p)||leprechaun (L)||leprechaun (L)|
|giant rat (r)||giant rat (r)||giant rat (r)|
|acid blob (a)||acid blob (a)||acid blob (a)|
|evil eye (e)||floating eye (E)||floating eye (E)|
|hurkle (h)||homunculus (h)||homunculus (h)|
|neevil (n)||imp (i)||imp (i)|
|orc (o)||orc (O)||orc (O)|
|yellow light (y)||yellow light (y)||yellow light (y)|
|zombie (z)||zombie (Z)||zombie (Z)|
|giant ant (A)||giant ant (A)||giant ant (A)|
|fog cloud (f)||fog cloud (f)||fog cloud (f)|
|robber (R)||nymph (N)||nymph (N)|
|stalactoid (s)||piercer (p)||piercer (p)|
|queevolt (q)||quasit (Q)||quasit (Q)|
|quivering blob (Q)||quivering blob (q)||quivering blob (q)|
|grabber (G)||violet fungi (v)||violet fungi (v)|
|nepto (N)||giant beetle (b)||giant beetle (b)|
|centaur (c)||centaur (C)||centaur (C)|
|cockatrice (C)||cockatrice (c)||cockatrice (c)|
|ghost (')||gelatinous cube (g)||gelatinous cube (g)|
|jaguar (J)||jaguar (j)||jaguar (j)|
|killer bee (K)||killer bee (k)||killer bee (k)|
|viper (v)||snake (S)||snake (S)|
|ice ball (i)||freezing sphere (F)||freezing sphere (F)|
|giant bear (B)||owlbear (o)||owlbear (o)|
|oxidizer (O)||rust monster (R)||rust monster (R)|
|unox (u)||giant scorpion (s)||scorpion (s)|
|teleporter (t)||teleporter (t)||tengu (t)|
|wraith (w)||wraith (W)||wraith (W)|
|snowman (S)||long worm (w)||long worm or wumpus (w)|
|octopus (0)||large dog (d)||large dog (d)|
|xyloman (x)||leocrotta (l)||leocrotta (l)|
|faker (F)||mimic (M)||mimic (M)|
|minotaur (m)||minotaur (m)||found at end of table|
|troll (T)||troll (T)||troll (T)|
|ugod (U)||ugod (u)||unicorn (u)|
|xerp (X)||yeti (Y)||yeti (Y)|
|phase shifter (P)||invisible stalker (I)||stalker (I)|
|hydra (H)||umber hulk (U)||umber hulk (U)|
|vampire (V)||vampire (V)||vampire (V)|
|wumpus (W)||xorn (X)||xorn (X)|
|rock lobster (L)||xerp (x)||xan (x)|
|zelomp (Z)||zelomp (z)||zruty (z)|
|chameleon (:)||chameleon (:)||chameleon (:)|
|dragon (D)||dragon (D)||dragon (D)|
|energar (E)||ettin (e)||ettin (e)|
|floor fiend (;)||lurker above (')||lurker above (~)|
|landshark (&)||neo-otyugh (n)||nurse (n)|
|argus (})||trapper (,)||trapper (,)|
|mega-worm (M)||purple worm (P)||purple worm (P)|
|demon (d)||demon (&)||demon (&)|
Other monsters kept in separate structures
All versions of Hack and NetHack prior to NetHack 3.0.0 have various monster description structures floating around in their source code, for monsters with special functions. These are listed here, with monsters having the same function in the same row. The large dog appears both here and in the above table because the structure in the above table is used for wild dogs, and the one shown below is used for pets. In Hack 1.0, the shopkeeper is moved to the main monster list.
|Hack121||PDP-11 Hack||Hack 1.0|
|vampire bat (b)|
|shopkeep (☺)||shopkeeper (@)||in main monster table|
|guard (☺)||treasurer (@)||guard (@)|
|little dog (d)||little dog (d)|
|dog (d)||dog (d)|
|large dog (d)||large dog (d)|
|giant eel (;)|
The character for the ghost is coded as a tab character, or '\t'. This is likely to be a bug or an arcane hack.
The giant eel appears in essentially its modern form. The current version of AEB Hack at the release of the PDP-11 Hack was 1.0.1, and this version did not have giant eels. Giant eels do appear in Hack 1.0.2, and the source code credits the publishers of PDP-11 Hack, Michiel Huisjes and Fred de Wilde, for the inspiration. That credit is still present in NetHack 3.4.3.
Hack121, PDP-11 Hack, and Hack 1.0 show many similarities in their object lists. Except as noted, the object lists are presented in the order in which they occur in the code. PC/IX Hack is the same as PDP-11 Hack except as otherwise noted.
Hack121 takes a different approach to armor than the other two Hacks. The only actual armors are suits. A shield is implemented but is a distinct type of object, in a class by itself. However, note that a shield is put on using the same command used to put on armor and affects your armor class rating in the same way that other armor does. PDP-11 Hack implements only suits and an elven cloak. Hack 1.0 adds a helmet, a shield, and a pair of gloves, allowing five pieces of armor to be worn at the same time.
The list of hack121 suits is reordered here to match the PDP-11 and Hack 1.0 orders.
|plate mail||plate mail||plate mail|
|splint mail||splint mail||splint mail|
|banded mail||banded mail|
|chain mail||chain mail||chain mail|
|scale mail||scale mail||scale mail|
|ring mail||ring mail||ring mail|
|studded leather armor||studded leather armor|
|leather armor||leather armor||leather armor|
|elven cloak||elven cloak|
|elfin chain mail|
|pair of gloves|
The available food items are as follows:
|food ration||food ration||food ration|
|tripe ration||tripe ration||tripe ration|
|dead lizard||dead lizard||dead lizard|
|spinach||candy bar||candy bar|
|clove of garlic|
As Hack121 does not appear to have pets, it is unclear why the first five items are all meat.
The dead lizard has no special properties in PDP-11 Hack. Its function in hack121 is just as an item of food. It has no other special functions. In Hack 1.0, it can relieve confusion, but has no effect on cockatrices: stoning by cockatrice hissing is an instadeath in all three of these versions of Hack. Both spinach and steak may randomly increase strength in hack121.
Hack121 and PDP-11 Hack offer the same set of weapons. Hack 1.0 adds a few to these:
|sling bullet||sling bullet||sling bullet|
|crossbow bolt||crossbow bolt||crossbow bolt|
|long sword||long sword||long sword|
|two handed sword||two handed sword||two handed sword|
Several potions in Hack121 have disappeared in later versions. Hack 1.0 adds one potion over PDP-11.
|restore strength||restore strength||restore strength||restore strength|
|extra hit points|
|fruit juice||fruit juice||fruit juice||fruit juice|
|monster detection||monster detection||monster detection|
|object detection||object detection||object detection||object detection|
|gain strength||gain strength||gain strength|
|gain level||gain level||gain level||gain level|
|extra healing||extra healing||extra healing||extra healing|
‡ PDP-11 Hack replaced the scroll of confuse monster with a scroll of losing. The porters to PC/IX reinstated the former as a potion.
Available scrolls are as follows. The Hack121 list is ordered in an attempt to match the other two.
|enchant armor||enchant armor||enchant armor|
|(different location)||(different location)||destroy armor|
|confuse monster||losing||confuse monster|
|scare monsters||curse levels||scare monster|
|remove curse||remove curse||remove curse|
|enchant weapon||enchant weapon||enchant weapon|
|create monster||create monster||damage weapon|
|damage weapon||damage weapon||create monster|
|rust armor||destroy armor||(different location)|
|gold detection||gold detection||gold detection|
|magic mapping||magic mapping||magic mapping|
For PDP-11 Hack:
- The "scroll of losing" takes away the hero's entire inventory and scatters it about the level. It is noted in source code comments as replacing the scroll of confuse monster.
- The "scroll of curse levels" appears to curse the hero himself, causing shopkeepers to be angry and all picked-up items to become cursed. The scroll of remove curse will rescind this effect, and in these versions it is not itself affected by curses.
- The scroll of transportation, as well as teleporting, functions as an elevator. The code carries the notice "Extended by Michiel and Fred: One can jump between levels".
Available wands are as follows. The Hack121 list is reordered in an attempt to match the other two:
|trap detection||secret door + trap detection||secret door detection|
|create monster||create monster||create monster|
|slow monster||slow monster||slow monster|
|speed monster||speed monster||speed monster|
|undead turning||undead turning|
|teleport monster||teleport monster||teleport monster|
|magic missile||magic missile||magic missile|
In Hack121, the wand of wonder is a random wand of another type which changes each time you zap it. In D&D, a wand of wonder works as a random wand of another type.
Note: In iLarn (and in ULarn), a wand of wonder prevents the player from falling down holes when in the main inventory. It could serve the same purpose here, as this would not be very apparent to most players.
Available rings are as follows. For hack121, the order has been changed to match the other two versions.
|see invisible||see invisible||see invisible|
|poison resistance||poison resistance||poison resistance|
|aggravate monster||aggravate monster||aggravate monster|
|fire and cold resistance||fire resistance||fire resistance|
|cold resistance||cold resistance|
|protection from magic||protection from shape-changers||protection from shape changers|
|gain strength||gain strength||gain strength|
|increase damage||increase damage||increase damage|
|increase hit points|
It is uncertain if the hack121 ring of protection from magic has any connection to the ring of protection from shape changers in the other versions.
Hack121 appears to have gems, but their function is uncertain. In PDP-11 Hack, they only add to the player's score; neither of these Hacks has unicorns. Hack 1.0 has gems in their modern form.
The remaining objects in each game seem to have no connection to each other. Hack121 has these objects:
- the sphere of power
- tinder box
- flask of oil
- shield (which is not a type of armor in this game)
PDP-11 Hack has only the "amulet of Frobozz", which may be the forerunner of the Amulet of Yendor.
Hack 1.0 has these objects:
- magic whistle
- expensive camera
- ice box
- heavy iron ball
- iron chain
- enormous rock
- the amulet of Yendor