Comments
The nethack source code has some illuminating and embarrassing comments. Here is a selection, just to get you the feeling.
Illuminating
From pray.c for the function god_zaps_you, about what happens if your god decides to destroy you with a wide-angle disintegration beam but you are disintegration resistant.
/* "I am sometimes shocked by... the nuns who never take a bath without * wearing a bathrobe all the time. When asked why, since no man can see them, * they reply 'Oh, but you forget the good God'. Apparently they conceive of * the Deity as a Peeping Tom, whose omnipotence enables Him to see through * bathroom walls, but who is foiled by bathrobes." --Bertrand Russell, 1943 * Divine wrath, dungeon walls, and armor follow the same principle. */
From the beginning of spell.c explaining how spellcasting penalties work. It's worth to check out the full comment there.
* Tou are aware of magic from all the great films they have seen
From trap.c in the mintrap function, on what happens if a monster falls into a trap made by you, or triggers a bear trap or land mine set by you.
/* Monster is aggravated by being trapped by you.
Recognizing who made the trap isn't completely
unreasonable; everybody has their own style. */
Funny
In objects.c
/* "If tin whistles are made out of tin, what do they make foghorns out of?" */
Embarrassing
In spell.c function spelleffects, where it creates a stack of 20 spellbooks as a pseudo-objects that it passes to functions that normally expect a scroll or potion.
pseudo->quan = 20L; /* do not let useup get it */
In weapon.c function dmgval, when computing bonuses for blessed or silver weapons
/* if the weapon is going to get a double damage bonus, adjust this bonus so that effectively it's added after the doubling */ if (bonus > 1 && otmp->oartifact && spec_dbon(otmp, mon, 25) >= 25) bonus = (bonus + 1) / 2;