# User:Phol ende wodan/SearchingProposal
This is a short proposal to revise NetHack's searching mechanics.

Contents

1 Current System and Problems
2 Previous Ideas and Proposals
3 New Searching System
4 Issues with this system

Current System and Problems
Searching works by computing the chance that you find something (a trap, a secret corridor or door, a hidden monster, etc) each time searching is triggered. This can be triggered manually via the search command, or every turn if the character has automatic searching. There are only a few variables involved in the character's success: primarily their Luck, but also whether they are wearing lenses, and the enchantment on their wielded Excalibur. The #untrap command on doors and chests to search for traps uses a similar system in general, but different specific formulas (involving XL and status impairment as their only variables).
This has some statistical problems: since it is never possible to guarantee for any one search that all possible hazards have been found, it is never possible to guarantee that no hazard exists. The more times you search and find nothing, the more likely it is that there is actually nothing. This encourages players to search many times to obtain a high degree of confidence that no such hazard exists, which violates a common design principle: the optimal strategy for the player to take should not be tedious to perform.
Other lesser problems with the specific formula used are that it puts far too much emphasis on the importance of luck (FIQ pointed out that with even a small amount of negative luck, it can take thousands of turns to find something), and that it doesn't incorporate any relevant ability scores, such as Wisdom or Intelligence or even Dexterity.

Previous Ideas and Proposals
FIQHack uses a buffed search algorithm that works more than 1 square away from you, but with a diminishing probability of finding anything at greater distance. It also makes rings of searching chargeable, for giving a larger bonus. Secret doors and secret passages are guaranteed to be found in a single search if your Luck is non-negative and you are adjacent to the feature. Traps next to you can be found, guaranteed and in one search, only if you have a +4 bonus from ring(s) of searching. In all other cases, you still have a random per-search chance of failing to find something. Overall, the system fixes some situations where vanilla searching can get aggravating (for instance, spawning in a room with no visible exits and taking dozens or hundreds of turns searching the walls to find the secret door), but it still retains some of the issues, like being able to keep searching and searching and still have a non-zero chance of finding a hidden trap.
The most commonly suggested unimplemented idea for fixing searching is some sort of a system in which after a finite number of turns spent searching, your character is guaranteed to have found all possible hidden things. The number of turns could be dependent on several character-based factors: a Rogue with high stats could take very few turns to guarantee no still-hidden items, whereas a starting Caveman could take very long to do this. The problem with this, or any system that guarantees that you will find everything hidden, is that optimal gameplay still consists of searching everywhere. The only functional difference is the slight improvement that you can now be sure there isn't still a trap lurking around that you failed to find over and over again.
Another issue that some people have raised is that any system that guarantees finding a trap basically neuters all traps: optimal play means that you will absolutely never run into an undetected trap. This makes traps just another annoyance for chumps who don't want to have to search everywhere they go.
Also suggested, but a bit tangential, is the idea of autosearching a door or a box immediately before you interact with it. This is fine, but doesn't really address any of the core problems with searching.

New Searching System
The main goal is to get rid of any incentives for the player to search something repeatedly. Ideally, they shouldn't really have to use the search command for routine dungeon exploration at all.
To this end, all searchable things now have an associated obscurity, which represents how hard it is to find. Obscurity is computed based on several things, and is independent of player stats:

The level difficulty
What sort of searchable feature it is (secret doors and passages are easier than traps)
Possibly, the trap type (a pit could be easier to find than a dart trap)
A random factor, deterministic based on the coordinates of the trap
Then, the player has a searching ability, dependent only on their stats:

Wisdom or Intelligence could be a major factor, also probably experience level
Intrinsic or extrinsic searching would provide a boost
Whether the player is searching deliberately with the s command, indicating that they're suspicious.
Luck should probably NOT be a factor
Role and race are possibilities, but ultimately probably not because there isn't enough flavor
If the player's searching ability equals or exceeds the obscurity of the trap, the trap is detected. Note that neither the computation for the obscurity nor the searching ability involve any non-deterministic logic, so repeating a search will give the same result.
The search command is made directional, so that searching doors and boxes (if the player selects a square with a box on it) is intuitive. The obscurity for secret doors and passages is low enough that they can always be revealed by a deliberate search for all characters (so that characters don't get trapped by undetectable doors or corridors).

Issues with this system
Ultimately, this does not resolve the problem with optimally searching every floor space once. However, at least it means that a single search is sufficient. A couple people have commented that this problem seems to be intractable unless the cost of searching everything is raised, possibly by making the hunger clock tighter. Chris also recommends that a way to display where monsters have stepped be implemented before or along with this proposal, as that would cut down on the need to search in front of you.