Knights and Knaves



"And over there we have the Labyrinth guards. One always lies, one always tells the truth, and one stabs people who ask tricky questions."

- Xkcd, Labyrinth Puzzle

So the heroes are crawling through a dungeon, or infiltrating the Evil Overlord's Supervillain Lair, or popping down to the shops for some milk or what have you, when they come upon a pair of doors, or a fork in the road, with each path guarded by a heavily-armed soldier (or animated statue, or whatever). They're somehow informed that one door leads to a truly inescapable Death Trap, while the other leads the way they're going, and they have to ask the guards which door is which.

The trick is, one of the guards always tells the truth, and - wait for it - the other guard always lies, and the heroes are allowed to ask only one question.

Sound agonisingly familiar? This is the classic Knights and Knaves logic puzzle (the Trope Namer is a particular version by mathematician Raymond Smullyan, but the puzzle considerably predates him), and invariably the scenario used every time in the media, to the point that it's a Dead Horse Trope. If you're lucky, the puzzle will spring for a bit of originality and involve a third guard who alternates between telling the truth and lying (or worse, a "normal," who can do either or neither at will). Smullyan himself invented dozens of variations and would probably be disappointed that it's just the one that ever gets cited.

For the record, the most common solution to the above scenario is to ask one of the guards, "If I asked you if the door you're guarding leads to where I want to go, would you say 'yes'?" If he says yes, then you go through his door, while you go through the other door if he says no. This is because his answer to this question doesn't depend on which guard he is. Say he says yes to the question. If he's telling the truth, then he would say that the door leads to where you're going, and thus, the door will lead to where you're going. If he's lying, then he'll have to lie about whether he'd say Yes to the question (which, in this case, he would not say yes if asked if the door led to where you're going, and would in fact say no) and, thus, is forced to give the correct answer to where the door goes. Of course, this requires that both guards know where you are going, and that neither of them considers "Your doom" a place.

The second most common solution is to ask either of the guards "If I had asked the other guard which door was the correct door, which door would he have pointed to?" They will both give the same answer (indicating the wrong door). If you're talking to the guard that tells the truth, he will (truthfully) indicate the door that the other guard would have steered you towards—which would be the wrong door, as the other guard always lies. But if you're talking to the guard that always lies, then he would still point to the wrong door, as while the other guard (the truth-teller) would have indicated the correct door, the guard you're speaking to is lying to you about what he would have said! So either way, the answer to your question will be the wrong door—and so, either way, you simply use the other door.

Note that if a character in these puzzles is said to always lie, then it is (probably) Not Hyperbole, unlike in real life. Real life "liars" are intending to make people trust them, and thus are perfectly willing to at least occasionally tell the truth. One of these guys, on the other hand, will be Lawful Stupid Chaotic Stupid with regard to the habit of lying, and thus can be caught out as depicted in the picture, or by less violent means. However, note that one of the keys to this puzzle being a puzzle is that you have to get a piece of information out of these two guards, rather than just determine which one is lying, which is what prevents you from simply asking them what 2+2 is. Some works can forget this, and make the hero look like something of an idiot for going for needless complexity instead of Cutting the Knot.

It should also be noted that no author (except those of logic puzzle books) ever includes a more complicated or different version of the puzzle. Smullyan created numerous permutations of his own puzzle, including one with islanders who answer only "Da" or "Bal" instead of "Yes" and "No," and the point is to figure out puzzles without necessarily knowing which means what in English. Another is set in Transylvania, where people can be either sane or insane (insane people believe untruths) and either a human or a vampire (humans say what they believe is true, vampires say what they believe is false). Most often writers can be excused for not including these more difficult ones, as they would be very difficult for the audience to understand. Not that we would mind.

Heroes who have neither the patience nor aptitude for logic puzzles generally just skip straight to the violence when confronted with this one. In videogames, it can also be brute-forced by Save Scumming.

Of course, the puzzle was "meant" for people for whom a pair of armed guards are a formidable obstacle, rather than for the standard "hero" types. If the guards aren't monsters, obviously.

The real question is, was the guy who explained the rules telling the truth or lying?

Alternate Reality Games

 * Perplex City has a version with seven speakers, at least three of whom are knights and three of whom are knaves.

Anime and Manga

 * Subverted in Yu-Gi-Oh!. During the Duelist Kingdom arc, the Paradox Brothers confront Yugi and Jounouchi/Joey with this puzzle. Yugi correctly guesses that the brothers' description of the puzzle is, in fact, part of it, and that both the brothers are lying about the whole puzzle (since they both say that one always lies and one always tells the truth, which is impossible, since someone who always lies would be unable to give a honest description of the puzzle, and thus could never agree with someone who always told the truth), and outwits them his own way.
 * They're cheaters anyway. Whenever a person asks his question and chooses a door, they always claim the opposite door is the right one. Yugi tricks them by making them think he's choosing one door, waiting for their answer, and revealing he chose the other one..

Comic Books

 * Sally Acorn of the Sonic the Hedgehog comic solved one of these in the "In Your Face" special.
 * Done in the first story arc of Grant Morrisson's Doom Patrol: the twin priests of Orqwith must be asked a question in order to destroy their invasive reality. One says, "I am an honest man and I do not know why there is something instead of nothing"; the other says, "I am a liar and I do not know why there is something instead of nothing." Rebis correctly reasons that the honest one would not be able to call himself a liar, so the one who does must be the liar - but this means the other part of the liar's conjunctive statement must be false in order to make the statement false overall. So the liar is the one who knows the answer to the final question.

Film

 * Shows up in Labyrinth. It's played with, though, as Sarah falls down a trap door behind the door at the precise moment she announces herself triumphant. Still, she did get the right answer, and she did end up getting to the end.
 * Sarah would've been home free for picking the right door, had she not declared that the riddle was a piece of cake. The Labyrinth is a harsh mistress.
 * The speaker told Sarah the conditions: "One of us always lies, and one of us always tells the truth." If the conditions were valid, then that particular speaker was the truth-teller. If he was lying, then all bets were off.
 * One interpretation of the scene is that the guards are just messing with Sarah and that NONE of them actually knows which door leads to the center of the labyrinth.
 * The Licensed Game for the Commodore 64 includes this scene, but as the engine was too limited to let you ask specific questions, the solution is different: Open each door and see which path has the sign saying "To The Castle" and which says "To Certain Death". The real danger is assuming that something so obvious must be a trick and falling to your doom.
 * Arcade - though this is a bit of an aversion, since the guards
 * In Werner Herzog's Every Man For Himself And God Against All, Kaspar Hauser is asked this question by a doctor trying to test his intelligence. The doctor will accept only a complex answer, but Kaspar responds simply (and correctly, since the doctor did not include the proper constraints), "I would ask him if he is a tree-frog."
 * In Open Graves, the last step in the cursed board game is guessing which of two snakes' mouths to place your playing piece into, assisted in your choice by a Knights and Knaves question.

Literature

 * The short story How Kazir Won His Wife by Raymond Smullyan involves various more complicated variations on the puzzle, while the framing story is set on an island where the normal version has occurred.
 * Spoofed in the Discworld novel Lords and Ladies. To pass the time on their trip to Lancre, Ponder Stibbons mentions this puzzle to Ridcully and Casanunda. Much to Ponder's annoyance, Casanunda insists that the "logical" solution is to wrestle a weapon from one of the guards and force him at swordpoint to show them which door leads to safety. And inform him that he is going in first, just in case he tries any funny business.
 * Book Of Lost Things plays this annoyingly straight, with bridges rather than doors. As the kid who is allegedly an avid reader of Fairy Tales really shouldn't have to even think about it.
 * Played straight in Cecilia Dart-Thornton's Bitter Bynde trilogy, as a challenge to someone attempting to escape the realm of the faerie. The protagonist must determine which door leads her to freedom with a single question posed to the titular knight and knave (who, in this case, are trapped humans).
 * In a brainteaser by puzzle writer Dr. Crypton, the protagonist is visiting a one acre desert island, seeking his way to the island's only tourist attraction, a 100-foot tower. He comes to a crossroads, where four roads split off, and there are three natives there. The four possible tribes of natives: always tell the truth, always lie, can answer with truth or lies, or wait for someone else to say something and then say the same thing. And he can ask them only two questions.
 * A variant occurs in one of the Lone Wolf gamebooks. A performer brings out two children, masked so as to conceal their genders. One states "I'm a boy" and the other "I'm a girl." The performer confirms that they are indeed a boy and a girl, but at least one of them is lying, leaving Lone Wolf to determine the gender of each without asking any further questions. Of course, given the above information, if one of them is lying, the other must be as well, making this one as straightforward to solve as the classic version.
 * In Martin Gardner's Hexaflexagons and Other Mathematical Diversions, he gives the version where you are at a fork in the road with one native (who either lies or tells the truth), and want to find out which road leads to the village. As well as the traditional answer, he suggests you ask the yes-or-no question "Did you know they are serving free beer in the village?" and then just follow the road that the native sprints down.
 * Many puzzle books tend to include variations on this problem. For example, The Lady or the Tiger?: and Other Logic Puzzles starts off with signs, later switching to a sane/insane people, then inverts it to people who can only ask questions that may be answered yes or no (specific to the person asking said question).

Live Action TV
"Tony: All right, all right. Wait, wait! I have a question! What is the point in having a door that has a horrible death behind it? Huh? (picks up frog) Frog: Get your hands off me! Tony: What does that achieve? Frog: What are you doing? Tony: I mean, what is the purpose of your life? Just to be a pain? Frog: Don't touch me there, only my girlfriend touches me there! (Tony throws the frog through one of the doors) WHOA! (Tony slams the door, there's a large explosion and fireball) Wolf: I guess it's the other one."
 * The Doctor Who serial Pyramids of Mars featured this as one of several puzzles the Doctor had to solve to enter the titular structure. This incident is an example of solution #2, asking the one guard about what the other guard would have said. Why an ancient Martian pyramid imprisoning a Sufficiently Advanced Alien was protected only by logic puzzles is unknown. The Doctor, being the clever bastard that he is, figures it out in about 15 seconds. According to the DVD production notes subtitles, Phillip Hinchcliffe got it from Franz Kafka's The Castle, although this cannot be confirmed.
 * Straight example in the math-and-logic Edutainment Show Square One TV, with the three-person variant. The alternating character, when asked who he was, said he was the knave, which neither the knight nor the knave would say. Then the knave claimed to be the alternator, which the hero had already identified, leaving the last person to be the knight. Of course, this is a little contrived, as both the Knave and the alternating character could claim to be the Knight, in which case you'd be stuffed, since all three would be claiming the same thing.
 * Subverted in the Miniseries The Tenth Kingdom. Two doors to safety or death are guarded by a talking frog who offers one question, but claims to always lie. By now the father of the protagonist Virginia has had it with this kind of puzzle.


 * Discussed in the Canadian kids' show Radio Active, where the students are assigned the problem in class but the proper answer is never figured out.
 * Is analysed as one of the puzzles on Dara O'Briain's show School Of Hard Sums with the catch that you can only ask one question. The answer given in the show is  which always results in.

Radio

 * Parodied in the first episode of John Finnemore's Souvenir Programme in this sketch.

Tabletop Games

 * Subverted in an Exalted adventure. The party discovers this puzzle in an ancient refuge for Solars, incredibly powerful near-demigods who were deposed centuries ago.
 * A similar situation exists in Warhammer 40000 with Kairos, a Lord of Change, now known as the Fateweaver. He knows everything, but when asked a question, one head gives the correct answer, while his other head give an equally believable lie.
 * And, what with him being a demon of Tzeentch, nowhere is it actually stated that the correct answer is given by the same head each time...
 * Dungeons and Dragons
 * Module I3 Pharaoh. Inside the tomb of Amun-re the PCs can encounter an androshpinx who offers to play a Riddle Me This game with them. If they can answer one of his riddles he will answer a question from them about the tomb. Riddles he can ask include one of these puzzles. People who live on the west side of Bindon always tell the truth, people who live on the east side of Bindon always lie. However, people who live on one side of town can sometimes be found wandering around the other side. If you're in Bindon, how can you find out which side of town you're currently on by asking someone? Answer: ask a passerby . Then just hope the person you ask isn't a visitor from out of town...

Video Games

 * The town of Zozo in Final Fantasy VI is part of a Knights and Knaves puzzle where everyone in town is a Knave, except for one person who doesn't even contribute to the puzzle.
 * Featured/spoofed in the browser-based MMORPG Kingdom of Loathing. During the final quest, you have to guess the password to a door from clues garnered from four guards. One always tells the truth, one always lies, one alternates between the two, and the fourth one... craves human flesh (and never says anything but "Graaaaagh").
 * The video game series Ultima features a two-headed horse called the Pushmi-Pullyu, whose heads are a Knight and a Knave. The puzzle is substantially simplified to fit the interface—however you put the question to it, he answers by telling you what his other head would say. And since his explanation of his nature is the same whichever head is speaking, there is something of a flaw in the setup. Not that it really matters anyway, as he tells you only which of two routes is less dangerous, but by the time the player reaches him, neither route is particularly dangerous, and the Money Spider enemies actually make the "wrong" answer more attractive.
 * Played quite straight with three different agents (liar, truth-sayer and alternator) in Pathologic. Except that you can cheat and use a disguise to figure out which is the liar.
 * A variation of this problem appears as a puzzle in Escape from Monkey Island, where Guybrush needs to find hidden treasure with the help of two parrots named Huggyn and Kyssin, who are enchanted by voodoo magic to always tell the truth and lie, respectively. The catch with this variation is that you're asking for directions where there are at least three choices at each intersection. Also, the parrots are identical and fly up and off the screen, then come back after answering a question, so you can no longer tell which one tells the truth.
 * This puzzle appears in Zork Zero. The catch here is that which one lies and which one tells the truth is randomized each time you enter the room, and while in the room, you're not allowed to save.
 * A valley near Esthar in Final Fantasy VIII contains a multitude of talking rocks that put Squall's wits to task with this riddle... in theory. In practice they're pretty much all full of it, and it's easiest to solve the puzzle simply by wandering around pressing the X button until you hit the right spot.
 * Played with in Shadow Hearts: Covenant: Lucia's bonus dungeon is a multi-junctioned forest where you are told (by a white flower) that white flowers will always try to help you while the black flowers will always try to mislead you..
 * The real kicker is that.
 * Neopets does this too in the Tale of Woe (an old Plot). There was this Mutant Hissi, which you had to question. (For those who don't know, a Mutant Hissi has two heads.) The solution is to stab one of the heads, and then ask: "Did it hurt?" If the head answers no, it lies.
 * The Legend of Zelda: Phantom Hourglass combines this trope with Ten Little Murder Victims: Amongst the members of the Isle of Frost's Anouki tribe is a Yook, their chief enemy on the island, and he's so well disguised that the only way to identify him is that Anoukis always tell the truth while Yooks always lie.
 * The Elder Scrolls Adventures: Redguard, Clavicus Vile poses this riddle to the protagonist Cyrus. He's Genre Savvy enough to ask if Cyrus had a classical education first, knowing it wouldn't be much of a riddle if he'd heard it before.
 * Several variations appear in the Professor Layton series.
 * The shareware game MasterSpy by Albert Ball partly hinges on this; there are three information sources (letters, telephones and radios) and one of the keys to success is to figure out which one of the three is telling the truth. Of course, even the two liars give useful information by virtue of the fact that you know it to be false.
 * In the Umineko fan novel "Witches and Woodlands," the heroes are presented with this trope during their quest. Most of them already know the solution, and Battler chides Beatrice for getting so lazy with her puzzles. Unfortunately, Erika refuses to use the standard solution, so she uses the existence of red text to figure out which guard is the liar and which is the truth-teller. Everyone is suitably impressed... until the NPC in charge of the test reminds her that the point was to figure out which door was the safe one, and she just wasted the party's one question. (Bonus points for referencing the Labyrinth and Order of the Stick examples during the test.)
 * Sonic the Hedgehog 2006 got really stupid with this one. The Soleanna police force, intent on giving Sonic the runaround, have informed him that to progress beyond this point of the game he must ascertain which of them is the man authorized to open the door preventing him from doing so. Not only that, at least one of the five is going to lie to him. The answer ends up being.
 * Ib has a Room of Liars early on with six inscriptions below six different portraits telling you which tile to pull in the next room over or which portraits can be trusted. As expected, all of them are lying with one sole exception. Once you figure out the trick and solve the puzzle, your next visit to the room greets you with the sight of the truth-teller's portrait splattered with blood and the other portraits with blood on their hands...

Web Animation

 * The Homestar Runner game Where's An Egg is based on this, only with 9 knights or knaves and a limited set of questions you can ask. Oh, and it's in Russian

Webcomics
"Pokey: (Hacking at one of the doors with a sword) Does this hurt? Door: AAAAAAGGHH! AAAAIEEE!!! NOT IN THE LEAST!"
 * Spoofed in Chicanery, where Ness rants at length about how overused this device is after getting it from one of the doors in the gang's new secret lair. He even cites the use of this trope in Labyrinth: "Now you've made me think of David Bowie again. Thanks loads."


 * Xkcd also has fun with it here, as quoted above. The Alt Text takes it further: "And the whole setup is just a trap to capture escaping logicians. None of the doors actually lead out."
 * In Episode 327 of The Order of the Stick, this is the Test of the Mind the Order goes through to get to the Oracle of Sunken Valley (which prompts Roy to remark "that's the last nail in the coffin for the hope that these Tests would be even remotely original"). Haley solves it by shooting one of the guards, then noting that the guard she shot is screaming "you shot me!" while the other guard insists "she totally didn't shoot you". The next time Haley passes through, the guards remember her and hastily direct her to the correct path before she can do anything. Haley doesn't understand why, because the Oracle's memory charm means nobody remembers anything that happens in the valley except for the answer he gives them.
 * Girly features what probably is the most nonsense solution for the problem in the strip "Knights and Knaves". Basically, the right question is "Are you wearing a sombrero?" Of course, given the setup of that particular instance ("the correct path lies with the one who tells the truth"), any question you already know the answer to will do.
 * Parodied in Partially Clips: here. No solution is offered or expected, but for the record,.
 * Nobody Scores: Jane simplifies the problem by opening both doors and shoving the knight and knave through them.
 * In Rusty and Co: The Mimic tries to solve a version of the problem posed by two talking doors using its own... unique skillset. The next time this puzzle gets overcomplicated, but the one solving it is Rusty, with his own rather predictable question.
 * On Bob and George, when Mega Man gets to Gemini Man, one of them claims that they tell riddles (they don't) and begins with this one. When the other tries to protest, the first merely passes off everything as a lie. Mega Man just stands there, reflecting on what Wily bots have been reduced to.

Web Original

 * These cats.
 * Ricky and Steve do the "Heaven and Hell" version of this with Karl Pilkington on The Ricky Gervais Show. His answer is to pretend to be a postal worker and ask them to send God out to sign for it.
 * Rather hilarious bit of Fridge Logic is the fact that they use the "Hell-Door guard lies, while the Heaven-Door guard tells the truth" version, meaning that their answer isn't that much better, being overly complicated.
 * Journey Quest does this with Glorion ... demonstrating its safety.

Western Animation

 * This is one of the many puzzles presented to The Powerpuff Girls by Him in the episode "Him Diddle Riddle." Blossom uses the "If I asked the other person..." variant. She then tries to explain the whole thing to Bubbles and Buttercup, whose reactions could be summed as X.X faces. However, if you do follow the explanation, you find she used the right logic, but picked the wrong one, even though her explanation implies that she knew which one to pick.
 * Also subverted in an episode of Samurai Jack. A two-headed worm claims he'll grant Jack's wish if he can solve this riddle. Jack does, but it turns out both heads were lying, and one of them swallows him whole.

Real Life

 * An early (as in, from classic Greek times) version of this is the so-called "Epimenides Liar Paradox", in which Epimenides (a Cretan) claims that "all Cretans are liars". Discussed by Raymond Smullyan in What is the Name of This Book?, in which he points out that.
 * Or just because all cretans are liars doesn't mean all cretans lie all the time

Other

 * There was a brain teaser in a Doctor Who annual about two captured soldiers (astronauts?) who were told that they could make one statement, If their statement was judged as true they would die by lethal injection, if their statement was judged as false they would die by hanging. They managed to make a single statement that meant the judge had to let them go.
 * The answer?