Give correct hints for a code lock with repeated digits and slow down guessing
With a code that has the same digit twice, the usual hint counts a digit as both in place and misplaced, and the player is led astray. Here is the right way to score each guess, plus a waiting time that grows with wrong tries and ends on success.
Why this works
A hint must say something true about the secret as a whole, and a repeated digit can only be matched as many times as it really occurs there. Counting what each side holds, then removing the exact hits, gives a hint that never overstates, so the player can reason from it.
When not to use it
Skip the waiting time when the lock is a story puzzle that must stay friendly, or when guessing is already limited another way, such as a few tries. Skip the detailed hints when the lock is meant to be solved from clues in the world.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- A diagram of every state
- 32 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 "Give correct hints for a code lock with repeated digits and slow down guessing" (read_entry code-lock-feedback-with-repeated-digits) 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