Knights and Knaves: Labyrinth Variation

Posted by Bedaywi, Mark on November 19th, 2019

Read Time: 3 Minutes

In the movie "Labyrinth" the protagonist is asked a variation of the famous knights and knaves riddle. There are two doors, one which leads to a trap and the other which leads to the exit. There exists two guards, one which always lies and one which always tells the truth. What do you need to ask to know which door leads to the exit?

There are essentially four possibilities when refering to a person and a door.

Not Lier Lier
Not Trap yes no
Trap no yes

We want the answer of the honest person to always be yes when talking about a trap, and the answer of the liar to always be no, since the liar will always say the opposite. We can create a truth table out of this and find the required output.

Honest? No Trap? Required Output Including Lie
True True True True
True False False False
False True True False
False False False True

Looking at the output with the lie we can see that it resembles an xnor gate. Essentially asking Not Trap XNOR Honest to either guard will have them say yes when it is not a trap. Using more colloquial language we can ask, "Is the answer to are you honest and is the trap not behind you the same?"

This is a different question asked by the protaginist, there exists more than one solution. I thought it would be interesting to write up this solution because it means we can solve logic problems by creating a truth table and working backwards - a new tool, yay!