246: Labyrinth Puzzle

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
Labyrinth Puzzle
And the whole setup is just a trap to capture escaping logicians. None of the doors actually lead out.
Title text: And the whole setup is just a trap to capture escaping logicians. None of the doors actually lead out.


This comic alludes to a famous Knights and Knaves logic puzzle, and specifically to the version featured in the Jim Henson movie Labyrinth, with two doors and two guards. One guard always lies, and the other always tells the truth. One of the doors leads to freedom, and you can only ask one guard one question. The solutions to this riddle (and there are several, though all are somewhat similar) involve a tricky question indeed. If you want to give the original puzzle a try for yourself, don't read the spoilers below.

  • Solution 1: Ask one guard (it doesn't matter which one) which door the other guard would say leads out. Both guards will indicate the same door, which will be the door that doesn't lead out: the truthful guard knows the lying guard would point to the door that leads to certain death, and says so, while the lying guard, knowing the truthful guard would point to the right door, says the opposite, indicating the door to certain death.
  • Solution 2: Ask one guard (it doesn't matter which one) what his answer would be if asked what door leads to freedom. Again, both guards will indicate the same door, which is indeed the door to freedom: the truth guard would, straightforwardly, tell you the truth, while the liar, if asked what door leads to freedom, would point to the opposite, and, if asked his answer, must give the opposite of that — the true door.

Notably enough, both solutions require that the guards be aware of each other's practice regarding truth and lies, which is not stated in the riddle itself. There's another unspoken rule: that the lie is either a yes or a no. If you asked the liar something, he could lie and say, "I don't know," which would leave you with nothing.

Black Hat added a third guard here who would stab his spear to Cueball on every tricky question. But even if the questions from before are not tricky enough to get stabbed, there would be no helpful answer. And if Cueball asks one of the other guards, the answers can't help to find the correct door. The only saving grace is that Black Hat has seemingly forgotten to impose the limit of a single question, but depending on how stab-happy the third guard is or is not, this may not be enough.

The title text presents a typical behavior of Black Hat — no door in fact does lead out of this labyrinth.


[Three guards with spears stand in front of three doors. Black Hat and Cueball stand in front of the guards.]
Black Hat: And over here we have the labyrinth guards. One always lies, one always tells the truth, and one stabs people who ask tricky questions.

comment.png add a comment! ⋅ comment.png add a topic (use sparingly)! ⋅ Icons-mini-action refresh blue.gif refresh comments!


SOLUTION 2 DOES NOT WORK ONE QUESTION, NOT TWO, AND YOU DONT KNOW WHO THE LIAR IS. one answer of "this is the door" doesnt help beacuse you wont know the answer of the other guy. in which solution one will always get you the same door, and you pick the other one. solution 2 just gives you two different doors. no matter who you ask you will randomly get a door. if the guy says the truth you wont know that hes the truthfull one or not. AGAIN thruthful guy points to a door, the liar would have( if you asked him instead, OR could even ask both) pointed to the other door. again, asking that question does not give you two answers, because you. dont. know. who. the. liar. is.

Just ask which color is the sky.. -- ‎ (talk) (please sign your comments with ~~~~)

Oh, although the strip doesn't explicitly say so; in those riddles you can normally only ask one question. --St.nerol (talk) 23:00, 27 January 2013 (UTC)
There's another (more traditional) three-guard variation where one guard always tells the truth, one guard always tells a lie and the third alternates between pure truth and pure lie (and you don't know which flip they're currently flopped upon). But you still only get to ask one question of one guard. Have fun with that one. My personal solution certainly has a degree of convolution, but I've heard other workable answers. 02:24, 21 June 2013 (UTC)
I hope no-one considers this a spoiler to say but there is a trivial solution to the 3 guards problem, whether third guard is a spear handler or one that flips between truth and false hood, just try "Did you know that the pub in the village behing the freedom door is serving free beer all day, as long as their stocks last?" Then follow the guards through whichever door they use. Alternatively substitute beer for another commodity the guards may desire. 00:59, 7 November 2016 (UTC)
@‎, you would know which one lies but you would not know which door leads out. Tharkon (talk) 23:13, 10 October 2013 (UTC)
Eh, well, even if you had a perfect question to ask in this case, a lot of good would that do you: it'd only reveal the truth behind the setup, that none of the doors lead out. :p -- 08:20, 8 November 2013 (UTC)
Well yes it says that in the title-text. But good pick-up. 02:31, 6 February 2014 (UTC)

One question, of one guard. I really like the original form of this riddle. It's a bit of a trick, though. It is crucial that the guards "know" each other's rules, but this is not even implied. And if it was stated in the question, that would probably be a good enough clue to get you to the answer. Of course, once you know the answer it seems trivial, but I wonder what percentage of people actually worked it out for themselves? Another good one is Monty Hall, even though that is pure, straightforward probability. 18:11, 17 January 2014 (UTC)

With two guards, they wouldn't need to know each others role. If they know their own role - which they do - each can infer the role of the other. 13:01, 21 April 2016 (UTC)
I think somebody needs a hug! 18:11, 17 January 2014 (UTC)

The whole problem with this entire riddle is that if they are both liars you are screwed! Nothing in the riddle establishes a fact that they aren't liars. Now if there was a known truth teller in the riddle that explains the nature of the guards or the narrator does it, then the above solution works. {{unsigned ip|

As you aren't given a limit to the number of questions, you can just ask each guard if they're the stabby guard. If two say yes, the third one is the truthful guard and you can ask him which way the exit is. If two say no, the third one is the lying guard and you can ask him where the exit isn't. No tricky questions so the stabby guard shouldn't stab you. 18:14, 14 August 2015 (UTC)

I have a solution, but you need to ask multiple questions:
If the Stab Guard tells the truth:
Ask each guard, firstly, "Are you the Stab Guard?"
Truth Guard will answer "No."
Stab Guard will answer "Yes."
Liar Guard knows the answer is no, but, because he lies, will answer "Yes."
The one who said no is the Truth Guard, so you can ask him which door leads to freedom.
If the Stab Guard lies:
Point to the guard on the left, and ask each guard, "Does that guard lie?"
If that guard is Truth Guard, then Truth Guard will answer "No," while Stab Guard and Liar Guard answer "Yes."
If that guard is a liar, then Truth Guard will answer "Yes," while Stab Guard and Liar Guard answer "No."
Whichever guard gives a unique answer is Truth Guard, so you can ask him which door leads to freedom. NickOfFørvania (talk) 23:37, 3 November 2015 (UTC)

It's been solved on puzzling.stackexchange.com (given a specific definition of a tricky question): http://puzzling.stackexchange.com/questions/43092/xkcd-inspired-logic-puzzle 12:14, 24 September 2016 (UTC)

I remember a book where the main character kicked one guard in the face and asked if it hurt. (talk) (please sign your comments with ~~~~)

There's another unspoken rule: That the lie is either a yes or a no. If you asked the liar something, he could lie and say, "I don't know," which would leave you with nothing. Also, as Stabby MacStabberson does not appear to have any restrictions on what he tells you (that is, he has the choice between truth or falsehood,) there's no sure way out even if he wasn't tasked with stabbing you. 05:32, 30 April 2016 (UTC)

Who said the Stab Guard has a true sense of complex? He could just stab you anytime. Dontknow (talk) 00:37, 16 March 2017 (UTC)

Here's a solution, but it's quite stupid, and might not work, depending on if the guards appreciate their mothers: Just ask a random guard, point to another, and say this: "That guard told me your mom was wearing their shirt last night!" Then stand back, and let the chaos ensue. 16:14, 25 November 2019 (UTC)

"What would you say is the way out?" It doesn't seem tricky, but it's actually a meta-question. The guard knows what they would say is the way out. If the guard tells the truth, they would say the correct door. The guard tells the truth about telling the truth and says the correct door. If the guard lies, they know they would lie about what the correct door is. The guard lies about lying and says the correct door. 21:19, 3 February 2020 (UTC)