20-CS-110-001 |
Introduction to Computer Science |
Fall 2010 |
---|

**Solution to Double Doors II Puzzle**

Ask the first person, "If I were to ask you if the second
person is the unpredictable one, would you say yes?" If the answer is
"yes," ask the third person, "If I were to ask you if the left door
leads to riches, would you say yes?" If the answer to the first
question is no, then ask the second person the same second question.
The easiest solution is as follows: Let A, B, and C represent the three people (the truth teller, the liar, and the unpredictable one.) For question 1, ask person A, "If I were to ask you if B is the unpredictable one, would you say yes?" Note that if A is the liar, the introductory clause would cause him to lie about his lie and thereby tell you the truth. If A tells the truth, the introductory clause is irrelevant. If A is the unpredictable one, his entire answer is irrelevant because you are guaranteed to be asking the next question to someone who is not unpredictable. If the answer to first question is "yes," ask person C, "If I were to ask you if the left door leads to riches, would you say yes?" If the answer to the first question is "no," then ask B the same second question. The second question is guaranteed to yield a truthful response about the left door leading to the riches. If you are speaking to the truth teller, he will tell you the truth. If you are speaking to the liar, he will lie about his lie and therefore he will tell you the truth. |