Is there a way to guarantee a bones file?

I have an elven wizard that has found a huge stash of valuable loot by chance of trap-door discovering a multi-boned level. Unfortunately, he's about to die of starvation locked in a room, or be killed by the invisible monster that killed the others. He's too deep for him to fight and prayer is used up, he's going to die. I'd hate to see all this loot vanish before another more worthy character gets a chance to sort through all of it. Can I do something to ensure this level makes the bones file? If so, how? If not, what are the odds that it will store as bones?
Best Answer
Assuming you aren't on one of the levels that can't leave a bones file (basically any level that isn't randomly generated), there is a (depth/4)/(1+depth/4) chance of leaving a bones file. Both of those (depth/4)s are integer division, that is, rounded down.
There is no way to guarantee a bones file, but if you're deep enough into the dungeon, you're very likely to get one.
Reference: http://nethack.wikia.com/wiki/Bones#Ineligible_bones_levels
Pictures about "Is there a way to guarantee a bones file?"



Updated Bone Segmentation: Pulling Out All the Tricks and Hacks!
More answers regarding is there a way to guarantee a bones file?
Answer 2
One other possibility would also be to rev-genocide a monster that is typically more likely to turn your dead body into one of its own, such as a mummy or vampire. Let it/them go ahead and "ghost" you (pun intended) and just keep your fingers crossed, provided you still have any.
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Richard Clay Goodloe, Plato Terentev, Pixabay, veeterzy