Monday, June 16, 2025

The hardest logic puzzle ever

wiki

Three gods $A$, $B$, and $C$ are called, in no particular order, True, False, and Random. True always speaks truly, False always speaks falsely, and 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 3 yes-no questions; each question must be put to exactly one god. The gods understands 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. Each god knows everything.


You can ask a god multiple questions, and the second and third questions can depend on the answers to their preceding questions.


My solution below assumes the more challenging interpretation of Random: there is no way to force its answer with composite questions, and whatever it says is totally useless.


===================================


Solution


The key is that if we ask a non-Random God 『If I ask you whether $P$ is true, would you answer 「da」?』, then $P$ is true if and only if the answer is 「da」.


Hence we first identify a non-Random god by asking $A$ 『If I ask you 「Is $B$ more honest than $C$?」, would you answer 「da」?』. It could be seen that if it answers 「da」 then $C$ is non-Random, otherwise $B$ is non-Random.


Once a non-Random god $X$ is identified, we ask it the second question 『If I ask you 「Are you True?」, would you answer「da」?』to determine its identity. $X$ is true if and only if it answers 「da」.


Finally, we ask $X$ the third question 『If I ask you 「Is $A$ Random?」, would you answer「da」?』to determine the identities of the remaining gods. $A$ is random if and only if $X$ answers 「da」.

No comments: