Three Gods A, B, and C are called, in no particular order, True, False, and Random. True always speaks truly, False always speaks falsely, but whether Random speaks truly or falsely is a completely random matter.
Your task is to determine the identities of A, B, and C by asking three yes-no questions; each question must be put to exactly one God. The Gods understand English, but will answer all questions in their own language, in which the words for yes and no are “da” and “ja”, in some order. You do not know which word means which.
- It could be that some God gets asked more than one question (and hence that some God is not asked any question at all).
- What the second question is, and to which God it is put, may depend on the answer to the first question. (And of course similarly for the third question.)
- Whether Random speaks truly or not should be thought of as depending on the flip of a coin hidden in his brain: if the coin comes down heads, he speaks truly; if tails, falsely.
- Random will answer “da” or “ja” when asked any yes-no question.
What would your three questions be?
Q1: Ask god B, “If I asked you ‘Is A Random?’, would you say ja?”.
If B answers ja, either B is Random (and is answering randomly), or B is not Random and the answer indicates that A is indeed Random. Either way, C is not Random. If B answers da, either B is Random (and is answering randomly), or B is not Random and the answer indicates that A is not Random. Either way, you know the identity of a god who is not Random.
Q2: Go to the god who was identified as not being Random by the previous question (either A or C), and ask him: “If I asked you ‘Are you False?’, would you say ja?”.
Since he is not Random, an answer of da indicates that he is True and an answer of ja indicates that he is False.
Q3: Ask the same god the question: “If I asked you ‘Is B Random?’, would you say ja?”.
If the answer is ja, B is Random; if the answer is da, the god you have not yet spoken to is Random. The remaining god can be identified by elimination.
Source: Wikipedia