A basic knight-knave puzzle (for the purposes of this question) takes the form $Q(n, s, k, x)$, where:
$n$ men are guarding $n$ doors. The guards and doors are numbered for easy reference: Guard #1 guards Door #1, Guard #2 guards Door #2, and so on. $s$ doors leads to pots of gold (success), while the other $n-s$ lead to hungry lions (failure). The guards cannot move away from their assigned doors.
You know that $k$ guards always tell the truth (knights), and the other $n-k$ always lie (knaves).
You are allowed to ask $x$ questions in total - either interrogative or imperative. The questions do not have to be yes-no questions, and asking the same guard more than one question is permissible.
Singulars are corrected into plurals where applicable (e.g. asking a knight "point to the knave" when $n-k>1$, which gets treated as "point to all the knaves"), and vice versa.
A question can have no answer (e.g. asking a knight "point to a knight who isn't yourself" when $k=1$), multiple answers (e.g. asking a knave "who is the knight?" and getting a list of all knaves), or cause the guard to respond "KABOOM!" for logical paradoxes (e.g. asking a guard "if this sentence is true, does Germany border China?").
Under this notation, the classic case - 2 doors, 1 success, 1 knight, 1 knave, 1 question, "If I ask the other guard which door leads to the pot of gold, what would he say?" - would be $Q(2, 1, 1, 1)$.
(Some versions of the problem have guards present additional information, e.g. "Guard #1 says that Guard #2 is a knave", or introduce "spies" who always answer randomly, etc., but these aspects are not considered relevant for the purposes of this question.)
What conditions must $n, s, k, x$ follow for a knight-knave puzzle $Q(n, s, k, x)$ to be possible, and impossible?
Trivially:
- $n > s, k$
- $n, s, x > 0$
But what else?
Bonus questions:
- What if you were only allowed to ask yes-no questions (in which case the 4 possible outputs are "yes", "no", "(none)", and "KABOOM!" for logical paradoxes).
- What if there was a limit $c$ (where $c<x$) on how many times you could ask the same guard a question?
- If there are cases where a 100% guarantee is not possible and you are forced to make random guesses, are there at least optimal strategies to maximize your luck?
- Would allowing guards to move away from doors or exchange doors with each other change the outcome of these knight-knave puzzles in some mind-screwy way I haven't thought of?
- What if we extend the premise to cases where $m$ men guard $n$ doors, and $m≠n$?
- What if the guards and doors were impossible to identify and distinguish? (Like, say the room is circular and you're riding a carousel, and the carousel spins really fast between questions, making you dizzy?)
- What if $n$, $s$, $k$, and/or $x$ were countably infinite?