The Wizard of Yendor's level is not modified by dungeon depth; instead he adds to his base level the number of times he has died. This value is capped at 49.
Monsters with a base level greater than 49 (i.e. named demons) have their level capped at 50.
If the monster's base level is greater than the current dungeon level, decrease the monster's level by 1. Otherwise, increase it by 1/5 of the difference, rounded down.
If the monster's base level is less than the player's experience level, increase the monster's level by 1/4 of the difference, rounded down.
The monster's level is capped at the lower of 49 or 3/2 of its base level, rounded down. If negative, the monster's level is set to 0.