Route planning says there is no way, but the key is just behind you
Locked doors and keys make the same square worth visiting twice: once without the key, once with it. A normal search forbids that and gives up too early. Here is the small change that makes it find the real answer.
Why this works
What you carry changes where you can go, so the same spot is a different place with and without the key. Searching over where you are together with what you hold lets the way back be new, not already used.
When not to use it
Skip it when many different keys or counted items could be mixed, because every kind doubles the work. Then check the level by hand, or reduce the choices, or plan in stages.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 38 lines of example code with 5 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Route planning says there is no way, but the key is just behind you" (read_entry path-with-keys-and-locked-doors) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP