# NetHack/Printable version

The current, editable version of this book is available in Wikibooks, the open-content textbooks collection, at
https://en.wikibooks.org/wiki/NetHack

# Authors

* Kernigh, split book into chapters, started Building and Beginning
* Other and anonymous contributors

# Introduction and General Advice

NetHack is a free roguelike computer game. The goal of the adventurer is to descend through the dungeon and retrieve the Amulet of Yendor. You can download the game from the official NetHack home page. The game runs on Mac OS, Windows, Unix, and many other platforms.
The dungeon contains many monsters and other causes of death. NetHack is a very difficult game, especially for players who lack knowledge of Dungeons & Dragons and avoid reading the spoilers.
NetHack is a complicated game, and it can be difficult to understand all the details of how it works. There are numerous "spoilers" available on the Web; here is a fairly complete list. However, NetHack is very much an exploration and discovery game, and many people prefer to avoid reading spoilers, or at least to wait to read them until they have a hunch about how a certain part of the game works and want confirmation. If you'd prefer to figure out the game for yourself, here are a few tips that may help:
* Read the Guidebook that comes with the game.
* Inscribing the mystic word "Elbereth" on the ground can help to keep you safe. See the Guidebook for more details.
* Fortune cookies, graffiti and the Oracle will all give you cryptic hints, but only the Oracle's hints are guaranteed to be helpful.
* It's usually safe to try wielding or wearing items that aren't cursed (though a few particularly nasty items become cursed when worn). Pets are reluctant to step on cursed items.
* To determine what a magical item is, read a scroll of identify.
* To determine what special abilities your character has picked up, use a wand or potion of enlightenment.
* As mentioned in the Guidebook, if you play in explore mode you will have infinitely many lives and will start with a wand of wishing. Ascensions (victories) in explore mode do not count, but it can enable you to explore more of the dungeon than you could reach in a real game.

# Building

NetHack has several different build systems because its source code can be made to run on several different operating systems.
You might want to build NetHack yourself, to make customisations such as enabling wizard mode.

### Unix

NetHack has no GNU configure script. It is difficult to build on Unix platforms because it often makes incorrect assumptions about the system. If you want to build it, this book assumes that you are familiar with the Unix shell prompt, including the "make" command, "cc" command, and the options "-I", "-L", and "-l" of "cc".
After extracting NetHack, look at sys/unix/Install.unx. That file contains the instructions. This book only gives an example of how to use vendor patches to build a NetHack with tty, X11, and Qt support in one binary.

#### Vendor Patches

However, many Unix and Linux distros contain NetHack. It helps to obtain the patches used by your Unix or Linux vendor. This skips over the step where we modify Makefiles and header files to describe the Unix variant that we use.
For example, on OpenBSD, NetHack and patches are available in the ports tree.
The above command performs the following steps, if necessary:
In fact, since we have the patches, we probably also have the script for building. Continuing from above, we could make build or make install and have a copy of NetHack very similar to the binary package provided by the OS vendor.
However, one can make customisations. First move the source directory out of the ports tree:
The sources, already configured and ready to build, appear at /some/path/nethack-3.4.3.

#### Enabling the Windowing Systems

A windowing system, from the NetHack point of view, is code that allows NetHack to show itself on the screen. On Unix, these systems are available:
* tty: The traditional code which draws NetHack using ASCII characters on a terminal. If you like to play NetHack in an xterm or over telnet, then you need this.
* X11: A graphical version of NetHack using the X Window System and the Xaw widgets.
* Qt: Another X11 version, but using the Qt widgets

##### Requirements

* tty: You need curses and termcap/terminfo, but you already have them ("vi" or "nano" uses them). If you used your OS vendor patches, then your NetHack is already configured to build with the curses and termlib found on your system.
* X11: You need X Window System and Xaw. Using XFree86 or Xorg includes everything you need.
* Qt: You need Qt version 2 or 3. The sources say version 2, but version 3 seems to work.
To enable these environments, some #defines must be set in include/config.h. It is also possible to just use "-D" options to the compiler.
Several things in the Makefiles must be adjusted to support the different window systems. It might be easiest to create a "config" file of "make" variables, then copy the variable assignments into Makefile, src/Makefile, and util/Makefile.
OpenBSD had a setup where these three files automatically included a config file:
This is a merger of OpenBSD's X11 and Qt configs, designed to support both in one binary:
To use this on other systems, one must make some adjustments. The variable "LINKCMD" (instead of "LINK") and "NHDIR" are specific to OpenBSD, having been introduced by the vendor patches. Examine your vendor patches and determine which are the correct variables to set.
To set variables like "MOC" that are already set in some Makefile, the other setting must be commented with "#".

#### Build

A build is normally like

# Translating Roguelikes

This page is intended to contain a summary of information on how to translate NetHack or other roguelike games into other languages.

## Translations available

There is a Spanish translation of NetHack available. There are Japanese translations of NetHack and Slash'EM available.
The Spanish translation does not use GNU gettext, the universal system for translating all applications.
There is a Ubuntu roguelike translation project although it has just been started and is not yet active.

### Translations not released

Many other people have started (and often abandoned) work on other translations; search the rec.games.roguelike.* newsgroups for more info. If you find information on abandoned roguelikes, please post the original translator's contact information here if possible.

## Translation issues

Issues in translating roguelikes include:
* Issues that affect all software translators:
** conjugating verbs
** combining nouns and adjectives
** mixing numbers and nouns
** masculine/feminine
** single/dual/plural
* Issues specific to roguelikes:
** the parsing of text the user enters at the wishing prompt
For more info, see the appropriate threads in the rec.games.roguelike.* newsgroups.

# Beginning

This visual tour introduces one to NetHack. This chapter describes the beginning keys and dungeon exploration. More advanced combat will be at Combat.
NetHack can be difficult to play at first because
* there are several keys to learn
* the graphics are drawn with ASCII characters
* the various types of items are unfamiliar
NetHack makes this easier by providing graphical user interfaces in environments like x11 and Microsoft Windows. This tutorial will instead describe the tty (terminal) port. This port uses only ASCII characters and runs on a terminal, such as a Unix or DOS console or a telnet client. By learning the "tty" port, one can play on public telnet servers (like nethack.alt.org). One will also start recognising the ASCII letters of each monster (useful for reading Dudley's dungeon webcomic).
This tutorial will introduce the controls for the "tty" player as an example player explores the first two levels of the dungeon.

### Configuring NetHack

The configuration used in the screenshots below is:
In particular, note the use of "color" and "DECgraphics" to enhance the graphics. Boulders will appear as 8, which is easier to see than `, the default for boulders.
These options are stored in ~/.nethackrc on your Unix machine, or defaults.nh on your Windows machine. See the Nethack Manpage for more information.

### Starting NetHack

When one starts NetHack, one of two things happens:
* the saved game loads itself, or
* you are prompted for a new character
This is a new game. By default, the prompt lets you pick race, role, and gender. The example configuration uses "race:elf", so elf is assumed as the race:
Press [y] to let the game pick randomly or press [n] to use menus to pick. (Press [q] to quit NetHack.) After choosing the character, the game introduces the plot:
The game now stops at a --More-- prompt. This prompt gives the player time to read some text before NetHack decides to show additional text or return to the map. When you see this prompt, read (or skip) the text, then press space bar to proceed.
After proceeding from the plot introduction, the game shows the map for the first time. This is a map of dungeon level 1:
There are some things to notice about this screen:
* In NetHack, you and the other characters are literally characters. The @ with a cursor on it is you, the player.
** The d is a pet little dog. The d is highlighted because "hilite_pet" is on the configuration.
** You might start with a cat f or horse u instead. (Remember, "f" means feline and "u" means unicorn. Whoever added horses to this game thought that they were similar enough to unicorns to use "u".)
* Most of the screen is blank. The player has not explored most of this dungeon level.
** One room is visible. We can see the entire room because it is lit with dots . showing the entire room. (This dungeon contains many lit, rectangular rooms!)
** Because we have "DECgraphics", the wall looks like a box instead of hyphens - and pipes |. The wall contains closed doors + and a doorway . without a door. We cannot see past the doorway because it is not lit.
* If you start your own game, the room will look different. That is because NetHack randomly generates the dungeon each time. The room in the example does not contain items, but does have a fountain { east of the player.

### Moving Around

keys for movement :
| y | k | u |
| h | | l |
| b | j | n |
Learn the eight moving keys so we can move the @ around to explore the dungeon. These keys consist of four "vi" keys for moving in four directions (up, down, left, right), and four "diagonal" keys for diagonal movement.

#### vi keys

The four vi keys are [h], [j], [k], [l]. These keys originate from the "vi" editor. This text originates from Learning vi:Basic tasks.
We can move our NetHack @ character around the dungeon by using the [h], [j], [k], and [l] keys. Note: your arrow keys may be set up to work (especially on DOS), and you can use them if you like, but for proficiency, you should learn to use the letter keys. Many copies of NetHack, especially on Unix, do not have working arrow keys.
* The [h] key moves you left.
* The [j] key moves you down.
* The [k] key moves you up.
* The [l] key moves you right.
If you have trouble remembering this, keep in mind that [h] is leftmost, the letter [j] goes down below the line, the letter [k] pokes up above the line, and the [l] key is rightmost. (J also resembles an arrow pointing downward, if you squint a bit.)

#### Diagonal keys

The four diagonal keys are [y], [u], [b], [n]. These keys are not from vi. Look at their position on the keyboard to see how they work. The upper-left key "y" moves up and left, et cetera.
New players might prefer to use only the vi keys. The diagonal keys are necessary when fighting monsters and for moving faster on diagonal paths.

#### Numeric keypad

If you enable the "number_pad" option, you can use the numeric keypad to move.

### Exploring a Dungeon Path

Continuing with the example game, the player starts moving around in the room and encounters a door.
To open a door, press o for the open command. At the prompt,
because this door is to the left, press h for left to open the door:
The player now uses h, y, and k to travel along the path. The player encounters some intersections but continues to travel northwest:
In the darkness of the above corridor, the player can see ahead by only one square, but the player memorises the location of all discovered corridors and rooms.
The player discovers a second room. Remember that every dungeon is randomly generated, so when you play NetHack, you will not find the room in the same place. After the example player enters the room, the pet dog follows the player into the room:
The player opens another door and a sees a third lit room come into view. On entering the room, the player discovers a potion ! that is the first item that this player finds:
Because the dungeon is random, the items are randomly placed. If you are lucky, then you find good items early in the dungeon.

### Taking an Item

At first, we only know that there is a potion. (Because option "color" is on, the potion looks red.) The player can discover which object this is by walking to its square.
In this case, we discover that there are two items on one square:
The player presses [SPACE] to dismiss the --More-- prompt, and then grabs the items. To pick up an item from the dungeon floor, press [,] (comma). A comma looks vaguely as if it is pointing to the ground. (If option "autopickup" is on, then the player takes the items without pressing comma.)
Normally, pressing comma takes the item. In this case, NetHack wants to know whether to take one item or both. It presents a menu:
This is a typical menu. We can press [a] or [b] on the keyboard to select the menu items. Though some menus disappear after the selection of one item, this menu allows for the selection of multiple items. Thus, the player presses [SPACE] again to dismiss the menu.
When the menu is dismissed, we pick up the items:
We add both the potion and the money to the "inventory". The inventory (which one can view by pressing [i] for inventory) is the list of all items that this player carries. The 10 gold pieces are added to the "purse". Notice the "$:10" in the bottom line; it shows how much money this player has. The text "g - a puce potion" indicates that this potion was placed at inventory letter "g". When we want to use or drop items, our potion will be listed at "g" in the NetHack menus.
What does a "puce potion" do? This player does not know. Pressing [q] (quaff command) then [g] (inventory letter) to quaff (drink) our potion might show us, but this player chooses to keep the potion.

### Handling locked doors

Next, the player encounters a locked door. Obviously, only trying to open the door will not work.
The game documentation mentions the kick command ^D, which means to hold [Control] and press [D]. It says that "D" means door. Does that mean that we can kick doors?
So the player presses ^D and then [l] to kick the door to the right. WHAMMM!!! The player kicks the door again and again, and succeeds:
When you need to pass a locked door to continue exploring the dungeon, remember to use the ^D command to destroy the door. (If you are using the "number_pad" option, you can also use the k key to kick. In the future, you might learn other ways of handling locked doors.)

### Searching for secret paths

Using [l], [n], and [j], the player explores the path, but it ends. The player presses [s] (the search command) repeatedly to search for a continuation, but fails to find one. So the player turns back and moves upward.
At one point Fido, the pet dog, blocks the path. The message "You displaced Fido." means that the pet moved away when you tried to move to the pet's square.
Sometimes you can hear "sound" in NetHack. This does not involve your computer speakers; it is a message that the player heard something:
This path has also ended. The player presses [s] repeatedly to search. (Warning: Do not hold down the [s] key or any key in NetHack. You might not be able to release it before a monster attacks and kills your character.) We find a door:
Using [o] (open command) [h] (left direction) the player opens the door. First it resists but then it opens.
Though in this case there was no necessity in open this door, remember to use [s] to find such doors when you can find no other paths to continue.

### Boulders

The appearance of a boulder depends on the "boulder" option. By default it is `, but for this game it was set to 8.
A boulder blocks the path of the player. The player is able to push the boulder right using [l]. Note that pressing [l] normally moves the character right, and because a boulder is blocking the path, the player tries to push the boulder right when moving right.
(The player is pushing the boulder into an unknown path. It is better to push it into an already-explored path, so that the player knows that the boulder will not permanently block something.)
The following is a good position for a boulder:
Notice that the player can now pass around the boulder by pressing [u] (diagonal up-right movement) or [n] (diagonal down-right movement). This is one of those situations where knowing the four diagonal keys (y,u,b,n) instead of using only the vi keys (h,j,k,l) is important.

### Armor, gold, gem, light

Now, the player encounters another end of path, opens another secret door (finding Fido, the pet dog), goes downward to another room, finds another end of path, and discovers a third secret door. After opening the door, the map looks like this:
The player steps in and sees two items:
The [ represents armor. Walking to it shows that it is a pair of fencing gloves. The player presses [,] (comma) and takes it. The game assigns inventory letter "h":
The $ represents gold. In this case, the player adds 41 gold pieces to the purse for "$:51" total.
Now the player proceeds out the door and discovers another room. Note that from outside the room, only some parts of the lit room are visible:
The other parts of the room cannot be seen because the player is looking from the wrong angle. When the player steps in, more of the room is revealed. Stepping in reveals a * representing a gem:
The player takes two violet gems and leaves the room (finding Fido, the pet dog). After a walk left, up, right, and down, the player another sound. ("You hear the splashing of a naiad.")
Continuing, the player moves right. Again, the player can at first only see part of the room:
But there is a surprise when we step in...

### Identifying a character on the screen

This player has encountered a colon : on the screen. The staircase to the second dungeon level > is visible, but how do we handle the colon?
We are now interested in two keys on the keyboard.
* The colon [:] key (hold [SHIFT] and press [;] on many keyboards), which looks like a pair of eyes, is used to look at the contents of the current square. (Do not confuse the colon key with the colon : currently visible on the screen.)
* The semicolon [;] key looks at another square. It also looks like a pair of eyes, except one of the eyes is squinting toward a more distant object.
Because the colon : is on a different square than our player, we need to use the semicolon [;] key, not the colon [:] key.
Pressing [;] makes a "Pick an object." prompt. To pick an object, you move with the (h,j,k,l) and (y,u,b,n) keys as normal, except that this moves the cursor without moving the player @.
Here is the result of pressing [;] and then pressing [y] to move the cursor to the colon:
Now, with the cursor over the colon : on the screen, press the colon [:] key now to look at that square. (In the "Pick an object." mode, one can use one eye [.] to take a brief look, or both eyes [:] to take a look that involves reading more text, if available.)
We learn that the colon : at the screen is "a lizard (newt)":
Note the --More-- prompt, which appears because we pressed colon [:] to ask for more information if it was available. Pressing [SPACE] advances us beyond the prompt. We then read the NetHack "database" entry for newts:
As this is another --More-- prompt, the player finishes reading and presses [SPACE].

### First combat

The dungeon contains many monsters which try to kill the player. A monster is normally represented by a letter A-Z or a-z, but there are other monsters such as apostrophes ', semicolons ;, and colons : including this newt.
Some monsters are peaceful; NetHack not only identifies them as such when you look at them with the colon [:] key, but also warns you if you try to attack them in melee.

#### Ouch

Yet this newt is apparently not peaceful. When the example player pressed [k] and move upward, the newt responded with an attack:
Notice the meter for health points, it reads "HP:12(14)". This means that the player is hurt; from 14 points possible, this player has only 12. Should this number reach 0, our player dies.
This player has options, including the obvious ones:
* Fight the newt
* Flee from the newt

#### Attack

The player attempts to fight. To fight a monster in melee, one simply presses the key to move to the square of the monster. Because the monster is blocking that square, NetHack interprets the key as an instruction to attack the monster.
* Pressing [h] can move the player left, push a boulder left, or attack the monster at the left. In "Pick an object." mode (after pressing [;]), pressing [h] moves the cursor left for picking an object.
So the player presses [h] to attack the newt:
That was easy! This newt died after only one hit! (Note that there are other monsters which are more difficult to handle...)

#### Versus a lichen

Now consider this situation, later in the example game. The player has explored some more areas, moved some boulders so that they do not block a path. In NetHack, every player gradually heals, so after this exploration the player is again at "HP:14(14)" instead of "HP:12(14)", despite the earlier damage from the newt.
Then the player encounters a letter F. This monster is a lichen:
This lichen seems weak. It only "touches", and the HP meter still reads "HP:14(14)". Again, this time the player fights by pressing [h]:
"You miss the lichen." In NetHack, an attack sometimes fails to succeed. However the lichen was too slow to respond, and the player has another turn to attack, pressing [h]:
"You kill the lichen!" This is another weak monster, dead after one hit.

### The next dungeon level

Now that we explored the first dungeon level ("Dlvl:1") and found the stairway > down, it is time to proceed to the next lower dungeon level and explore. The player @ and pet dog d approach the stairway:
The one thing to remember is to not leave the pet dog (or cat, or other pets that you might have as a beginning player) on this floor! Pets are useful (though these pages have avoided spoiling how pets can help the player). So find your pet before using the stairway, as this player has done here.
Now move to the stairway:
(The downward stairway > is now not visible, because it is on the same square as the player @.)
The pet must be on any of the eight adjacent squares. (If not, press [.] to wait for the pet to come, or press [s] to both wait and search. Press the key repeatedly and carefully without holding it down; one extra key press could move away the pet that came.)
Now, the key to activate a stairway downward > is conveniently [>], the key with the same symbol as the stairway on screen. (On many keyboards, one types [>] by holding [SHIFT] and pressing [.].)
The player appears on the second floor:
Stepping off the stairway (toward the gold which this player wants) reveals that it is an upward stairway < because we are now at the bottom of the stairway. One can use this stairway to return upward. The only difference is to use the [<] key to use this stairway.
(If you ever find the Amulet of Yendor, return to the top of the dungeon using these stairways, then use the stairway < on "Dlvl:1" to exit the dungeon. But if you use that stairway to exit the dungeon before you find the Amulet of Yendor, then you end your game early.)

### The inventory

Now to press [i] and see the items. It is good at the beginning of every game to look at our items, but beginning players somtimes forget this. Here is the inventory of the example player:
This lists every item carried by the player. (There is also the gold "$:51" in the purse.) This includes "g", the puce potion, "h", the gloves, and "i", the gems, that we found earlier.
It also includes all of the items that is player started with. Notice that the player is wearing an "elven cloak". An "elven dagger" is marked as the "weapon in hand". This means that the player is wielding the dagger and using it in melee.
Wondered what this player was using to attack that newt and that lichen? The player was exclusively using this dagger to hit them. (A player without a weapon can attempt to fight with bare hands.)

### A corpse

After collecting some gold, the player sees a sewer rat and two grid bugs. This player decides to engage the sewer rat r. (The player can use [;] again to identify the sewer rat.)
The sewer rat attacks with a bite; on the next turn the player presses [l] to fight but both sides miss. In another turn, the sewer rat dies:
It left a percent sign %, which normally refers to a comestible, something one can try to eat. Yes, it is a "sewer rat corpse". A player on the same square as a corpse can press [e] to try to eat it:
This is a simple [ynq] menu in NetHack.
* Press [y] for yes, eat the corpse.
* Press [n] for no. In this case, NetHack does what [e] normally does when there is no corpse on the square; it presents a menu asking for an inventory item to eat. It is possible at said menu to press [f] which is the inventory letter of the lembas wafers of this player.
* Press [q] to quit this command if you want not to eat now.
The player decides to eat the corpse. "This sewer rat corpse tastes terrible!--More--"
But when the grid bugs x make threatening moves toward the player:
This player chooses to ignore the grid bugs and continue eating the corpse. (In some cases, this player might have wanted to try immediately to flee.) To continue eating the corpse, the player uses again the same [e] command. "You resume your meal. You finish eating the sewer rat corpse."

### Using an item from the inventory

Up to now, this player has not used any item from the inventory, other than the dagger already wielded and the cloak already worn. Often, item use is not early in the game; for example this player has not yet decided about that puce potion.
There are several commands to use items, here are some:
* [d] to drop an item (so the player can use [,] to grab it again)
* [D] to Drop many items
* [w] to wield a weapon
* [W] to Wear armor
* [T] to Take off armor
There are other commands, like [q] to quaff a potion; press [?] to read the NetHack help screens which provide a full list.
This player decides to wear those gloves. Thus the player presses [W] which makes a menu:
The menu options "[h or ?*]" mean that this player can press one of the following keys:
* [h] to Wear item "h" (the gloves)
* [?] to see a list of armor from the inventory
* [*] to see the inventory (trying to wear something unusual?)
The player presses [h] to wear the gloves. "You finish your dressing maneuver." A press of [i] to look at the inventory shows the gloves "being worn".

### Saving the game

This is the end of the beginning tutorial, which introduces the controls for the tty port of NetHack. There are two more keys we will mention:
* [S] to save the game
* [#] for extended commands (type "quit" [RETURN] to quit the game)
The [S] feature to save the game is important. A player can save almost anywhere in the game whenever a break from NetHack is necessary. The "#quit" feature, in contrast, should only be used to cowardly give up on the game; it announces your score and prevents you from continuing that game.
The example player now presses [S] to save the game:
With a [y], the game is saved. At the next time when the player starts NetHack (as the same user on the same computer), the game will continue from this point, with the player @ in the second dungeon level "Dlvl:2" wearing the gloves.

### References

* Learning the vi editor, Learning vi:Basic tasks

# Combat

This will be a visual guide to combat in NetHack:
* how to wield a weapon (press [w] and pick from the inventory)
* how to enhance skills with weapons (NetHack gives you a message; #enhance your skill; mention the upper limit to enhancement, but do not spoil it)
* how to throw objects (press [t], pick an object, use hjklyubn for the direction; you can throw potions, rocks, and miscellaneous items; you can press [Q] to "quiver" and item and throw it with [f])
* how to wield a ranged weapon and fire ammunition (wield bow or sling; optionally put ammo in quiver; throw or fire ammo while wielding the weapon; pick up and recycle ammo)
This is similar in scope to the NetHack Guidebook, but with screenshots.
Ammo test: If you are wielding the correct weapon, you can throw the ammo farther. This is a "spoiler" to anyone who does not know that a bow shoots an arrow farther than your hand.
Also, the fact that there are only eight directions to throw implies that you or a monster can avoid ranged attacks by not being in any of the eight paths. For example, you @ and the kobold k cannot hit each other with spears or arrows:
TODO:
* Make and upload NetHack screenshots.

# Choosing Role and Race

What type of character to play?
If you are a beginner, it is much easier to stay alive as a big dumb warrior (such as a Barbarian, Valkyrie or Samurai) than as a highly intelligent but physically weak magic user (such as a Wizard or Healer). Race is not as significant as class, although Elves have very low limits on their strength and constitution, so are not recommended to beginners. Alignment (whether you are lawful, neutral or chaotic) is also not too important; its main effect is on the artifact weapons you can obtain by sacrificing to your deity.
Lawful Human Valkyrie is an excellent combination for several reasons. Valkyries start with a highly enchanted small shield which can remain part of their armour for a long time. They also start with a good weapon, and if they are lawful they can dip it in a fountain to convert it into Excalibur. (The Lady of the Lake does not insist that you are a Knight, but she gets annoyed if neutral or chaotic characters try this trick.) Another excellent weapon, Mjollnir, is their guaranteed first gift from sacrificing. The Valkyrie's quest artifact is the Orb of Fate, which halves any damage they take, making it well worth lugging it around despite its weight.
The advantage of a Human Valkyrie over a Dwarven Valkyrie is that all inhabitants of the Gnomish Mines will be friendly to the dwarf but not necessarily to the human. Some see this as a disadvantage, but nothing in the Mines is particularly deadly. Killing the inhabitants is not advisable if they are peaceful, because your god will not approve, but is a useful source of food, experience and equipment if they are hostile.
A few other classes have special features which may help you to learn about the game:
* Barbarians have poison resistance, meaning that you can eat (almost) anything and learn which corpses are poisonous.
* Priests can detect whether items are blessed, uncursed or cursed, which helps with discovering the effect of blessing or cursing items.
* Wizards start with several magic items - useful for exploring what items exist in the game and what they do.
* Healers start with a stethoscope, which is handy for checking the state of health of a monster. Note, though, that Healer is one of the most difficult classes.

# Staying Alive

NetHack is not Quake.
Always remember that NetHack is a turn-based game. You have as long as you need to consider your options, even in the heat of combat. In fact, when you find yourself in a sticky situation, it is wise to walk away from the keyboard while you think about what to do next. You could even save your game and consult the spoilers or the NetHack newsgroup.
The better part of valor is discretion.
In NetHack, there are no prizes for dying with honour. When a monster is giving you a hard time, it is seldom wise to take one last swing at it in the hope that it will die. It is much better to escape from the situation and return when you are more able to handle it. One reason why experienced players are fond of speed boots is that they enable you to run faster than most monsters.
Running is not the only way of escaping a dangerous situation. It's a good idea to carry a scroll or wand of teleportation for emergencies. Most monsters won't follow you up or down stairs, though a few will. If you have a wand of digging, you can use it to dig a hole through the floor, though again, some monsters will follow you. A cursed potion of gain level will cause you to rise up through the ceiling.
If you can't (or don't want to) flee, you could try to heal yourself. Prayer is effective if you are in reasonable standing with your deity, you haven't pestered them for help too recently, and they recognise that you are in need of healing. Their definition of "in need of healing" is either 5 HP or less, or 1/7 or less of your maximum HP. If you don't meet this definition, try some other means of healing, such as spells or potions.
An alternative survival strategy is to inscribe the word "Elbereth" on the ground. This prevents most non-human monsters from attacking you hand-to-hand, though they can still use ranged weapons, wands and spells. You can scribble "Elbereth" in the dust with your fingers, but then it is easy to erode, so it is better to engrave it with a wand of digging, and even better to burn it with a wand of fire or lightning. For full details on how Elbereth works, see Kate Nepveu's Elbereth FAQ.
If none of the above applies, and you feel you have to keep fighting, bring out the magic items or spells rather than hacking away with your weapon. Rays bounce, so take care to avoid being killed on the rebound, for example by choosing a wand to which you are already resistant.
Sometimes an indirect approach is best.
Walking right up to a monster and whacking it with your melee weapon is not always the best approach. Some monsters, such as mumakil, hit hard but are slow enough that you should be able to keep your distance and kill them with ranged attacks. Others, such as floating eyes, are totally harmless until you hit them in melee, but have a nasty counterattack (in this case, they paralyse you with their gaze, leaving you vulnerable to any newt that may appear). Pay attention to monsters that it is unwise to attack in melee, and think about alternative strategies for handling them. If you don't have a good ranged attack (like a bow and arrows or a powerful wand or spell), then throw junk weapons, or even rocks.

## Newbie mistakes to avoid

Do not savescum, reroll, or use similar dodgy tactics.
Savescumming is the practice of making backup copies of your save files and restoring them when you die. Since this involves going behind the game's back, it is universally regarded as cheating. No-one will be at all impressed if you ascend by savescumming, especially not if you try to pretend that it was a genuine ascension.
Some people savescum in order to learn the game. This is harmless provided that you do not boast about savescummed games as if they were genuine and that you play on a single-user machine (you won't be able to savescum on a multi-user machine anyway). Even so, explore mode is a better option because it does not clutter up the high score table with scores obtained by cheating.
Savescumming and explore mode are generally considered to be a less effective way of learning than playing the game properly. When you can refuse to die, or save your game before a difficult encounter and restore it if you get killed, it is tempting to just keep trying the same strategy until you happen to survive, rather than thinking about ways to improve your chances.
Incidentally, it should not be necessary to back up save files as protection against your computer crashing. NetHack comes with a "recover" command for restoring crashed games.
Rerolling means that if you don't like the stats or items which your character starts with, you immediately quit and try again. Although this is a legitimate part of some other games (for example Angband) it is generally considered to be abusive in NetHack. Like savescumming (though to a lesser extent) rerolling is an ineffective way to learn the game - the ability to keep weak characters alive and to make do with the equipment you find is an important part of being a skilled NetHacker.
Many players who do not savescum or reroll will deliberately play in a risky manner in the early game, because you haven't lost much time if a beginning character dies. For example, they might drink from fountains hoping for a grateful water demon to grant them a wish, even though there is an 80% chance that any water demon they get will be hostile and will kill them. This is not considered as bad as savescumming or rerolling, but is still frowned upon by many NetHackers, who feel that you should try your best to ascend each character. Also, when you play this way you miss out on the valuable experience of struggling to keep a marginally viable character alive for as long as possible.
Do not attack peaceful monsters.
Some monsters will be described as "peaceful" when you look at them, and you will be asked to confirm any attempts to attack them. It is generally a good idea to leave them alone, for two reasons. One is that the gods disapprove of killing peacefuls, and will exact an alignment penalty, along with more severe penalties for killing a peaceful human (unless you are chaotic) or a unicorn of your own alignment. More details of the penalties for killing peaceful monsters can be found on this page of myths and facts about NetHack. Note, though, that there is absolutely no penalty for allowing your pets to attack peaceful monsters, or even for healing them as they do. Nor will the monsters retaliate against you for your pets' actions.
The other reason to leave peaceful monsters alone is that many of them are much stronger than you. In particular, tangling with a priest or shopkeeper is likely to lead to your death. (You can use a stethoscope to check how strong a monster is.)
Only pray if you have good reason to.
Some newbies feel that they "ought" to pray on a regular basis in order to keep in touch with their god. In fact, prayer in NetHack is always pestering the gods for help, never praising or thanking them. Hence your god does not mind in the least if you never pray, but does object if you pray too often. Once you get a negative response to a prayer, you will almost always be unable to pray until you have placated the angry deity with a suitable sacrifice.
However, prayer can save your life in an emergency. Just remember that your god's definition of an emergency may not be the same as yours. Wounds aren't an emergency until you are either at 5 HP or less or at 1/7 max HP or less, and hunger isn't an emergency until you are weak from hunger. The praying spoiler gives much more detail about prayer.
Eat only fresh corpses.
Most corpses are safe to eat when fresh, though some are poisonous (see the Food section later for specific corpses which are particularly good or bad to eat). Old corpses, though, will make you fatally ill (and have no nutritional value either). There are a few ways to cure this deadly food poisoning, but it's best to avoid it, by not eating anything that you didn't kill yourself or see die. Since zombies and mummies are created by magically animating an old and rotting corpse, undead corpses are never safe to eat.
Don't eat while satiated.
If you eat while satiated, there is a risk of choking over your food and immediately dying. Eating once you have reached the point of satiety at which the game tells you "you're having a hard time getting all of it down" is particularly dangerous. Experienced players may be able to tell when they can safely eat despite being satiated, but it is safest for novices not to try it. An amulet of magical breathing will eliminate the risk of choking, and a tinning kit or an ice box will keep food fresh for later.
(As long as you are not satiated when you start eating, you should always be permitted to finish your meal. However, owing to a bug this may not apply if you save the game in the middle of a meal. At least one character has died from this.)

# Tactics with Items

This page answers:
* Which food is good to eat?
* How does one use the scroll of genocide?
* What is an Ascension Kit?

### Food

Eat these corpses:
* wraith (level up)
* giant (strength up)
* mind flayer (intelligence up or gain the telepathy intrinsic)
* floating eye (you get the telepathy intrinsic)
* quantum mechanic (you get the speed intrinsic if you don't already have it, but lose it if you do)
* blobs, jellies, fungi (F), gelatinous cubes and puddings (often hurts you a little, but a good way to gain intrinsics if you are observing vegan/vegetarian conduct. black puddings are not vegetarian. don't eat yellow fungi unless you can unhallucinate yourself.)
* lizard (if needed; cures stoning, lowers stun + confusion to two rounds, will not rot)
* unicorn (only eat unicorns that are not of your alignment, you can gain poison resistance, and help your alignment. these are also very good for sacrificing as well.)
* dragon (gain intrinsics that that dragon has, so red dragons give fire resistance, black dragons give disintegration resistance, green dragons give poison resistance, etc)
Don't eat these corpses:
* kobolds (sickens you, okay for any character who is poison resistant like orcs, barbarians)
* bats and stalkers (stuns you for a while)
* mimics (you can't move for a while)
* cockatrice, chickatrice, Death, Famine, Pestilence (you die)
* green slimes (slimes you)
* your own race (cannibalism gives you the aggravate monster intrinsic unless you're a caveman or orc)
* cats and dogs (gods don't like it, okay if you're a caveman or orc)
* werecreatures (you become one, considered cannibalism for humans)
* leprecauns, nymphs and tengus (you gain teleportitis, which unless you have teleport control, is very annoying because it makes you teleport to random places at random times. tengus can also grant teleport control.)
As a general rule, if your pet will eat it, you can too. (Exceptions: pets will eat dogs and cats, and tripe rations aren't for human consumption)

### Genocide

A blessed scroll of genocide removes all monsters with a particular letter. A uncursed scroll removes one single type of monster. A cursed scroll creates monsters of that type, which experienced players may find useful.
Genociding your own race is fatal
It's a good idea to genocide all kinds of liches (use a blessed scroll of genocide and take out "L"), because they are powerful spellcasters who can curse your items and summon hordes of nasty monsters.
Mind flayers and master mind flayers should also be genocided, because they eat your brain, causing you to forget what you've learned, and in extreme cases, to die from brainlessness. If your character is a dwarf, remember to use two uncursed scrolls rather than one blessed scroll!
If you have spare scrolls of genocide, consider getting rid of the following monsters:
* Eels (can drown you, but can be avoided with careful play, an oilskin cloak, or an amulet of magical breathing)
* Rust monsters and disenchanters (can damage your armour and weapons)
* Olog-hai and other trolls (have the annoying habit of constantly rising from the dead, though a tinning kit or hungry pets can make short work of them as well.)

### The Ascension Kit

"Ascension Kit" is a term experienced NetHack players use for the equipment they hope to have before entering Gehennom (Hell).
Ascension Kits provide extra speed (e.g. boots of speed or a spellbook of speed), magic resistance (e.g. a gray dragon scale mail, Magicbane or a quest artifact), reflection (e.g. a silver dragon scale mail, a polished silver shield or an amulet of reflection), boosted stats (e.g. Gauntlets of Power, Gauntlets of Dexterity, a Helm of Brilliance, any item of gain X), levitation (e.g. a ring or boots of levitation), something holding your stuff (a blessed bag of holding and an oilskin sack are nice), a pick axe for quickly traversing Gehennom's long, pointless mazes, lots of holy water for dealing with cursed items, and ideally at least one amulet of life saving.