# Trickery
The game declares a trickery when it detects manipulation of a level file or bones file.  Such an occurrence is taken as evidence of cheating and the game is declared forfeit.
A trickery that occurs in the absence of cheating is a bug.
Events that end the game in trickery are:

Removing a level file from a game in progress, possibly an attempt to cause the level to be generated anew.
Renaming a bones file in an attempt to load it on a different level from where it was generated.  This only happens if the bones file is actually loaded.
Copying a level file from a different game.
Copying a level file out of the playground, saving, restoring, and then copying the level file back in (even if the level hasn't changed; it's the process ID that is checked).
Some operating systems do not support process IDs; on these, the game cannot detect cross-game or cross-session copying of level files, and will not declare a trickery.
Not all possible cheating with level or bones files is detected as trickery.  A level file could be copied out of the playground and then copied back in, restoring the level to its previous state; or a bones file, once used, could be copied back into the playground for a future game.  Scumming with level files will be detected as trickery if the user saves and restores in the meantime, because that would be a different session of the game.

Consequences of trickery
If the game is in wizard mode, the message "You are a very tricky wizard, it seems." is printed, and the game continues (except for deleted level files).  Otherwise, the game immediately ends.  An amulet of life saving will not continue the game.
A game that ends due to trickery is not eligible to leave bones.

References
bones.c line 409 -- detects renaming of bones files, which if undetected would use the bones on a different level from where they were generated.
do.c line 1102 -- opens a level file for an already-generated level, to enter the level; declares a trickery if the file can't be opened.
restore.c line 722 -- detects renaming of level files to appear on a different level (dlvl&nbsp;!= lev) and copying of level files from another game or a different session of the same game (pid&nbsp;!= hpid).
save.c line 245 -- opens a level file to copy its contents to the save file; declares a trickery if the file can't be opened.
save.c line 351 -- opens the "level 0 file", which is not a true level file but contains the state of the game at the last level change; declares a trickery if it can't be opened or if the file belongs to a different game or session from this one.

This page may need to be updated for the current version of NetHack.
It may contain text specific to NetHack 3.4.3. Information on this page may be out of date.
Editors: After reviewing this page and making necessary edits, please change the {{nethack-343}} tag to the current version's tag or {{noversion}} as appropriate.