A random key lands in the room that only that key can open
Shuffling where the keys lie makes each run different, until one run hides a key behind its own lock and nobody can finish. This entry places keys so every run can be completed, and checks a layout you already have.
Why this works
Random is safe as long as every pick is made only from places the player could already reach. Building the layout step by step from what is open at that moment cannot lock a key behind itself, however the dice fall.
When not to use it
Wrong when the puzzle is a hand-made design where each key's place is the clue, or when you want hidden keys that need backtracking and the player may forget. There, place them by hand and test the layout instead of randomising it.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- 47 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "A random key lands in the room that only that key can open" (read_entry random-key-placement-behind-its-own-door) 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