## God, the Devil and Bob

A person dies and meets God, the Devil and Bob in his afterlife. He does not know which one is which. However, he knows that God always speaks the truth, the Devil always lies and Bob randomly speaks the truth sometimes and sometimes he lies.

He is allowed to ask each entity one or more yes-no questions. He is allowed to ask three such questions. He must deduce the identities of the three entities with the answers he gets in order to find a place in heaven. If he fails to do so, he is sent to hell.

How should he ask the three questions to get into heaven?

[SOLVED]

#### Indhu Bharathi solved this puzzle:

The trick is to ask "If I ask you <something>, would you tell me 'yes'?". Both God and Devil will be forced to give the right answer. We will have to handle Bob separately however.

To A: If I ask you "Is B Bob?", will you tell me "yes"?

Case "Yes":
Either A is Bob or (A is not Bob and B is Bob) ⇒ C is definitely not Bob.

Case "No":
Either A is Bob or (A is not Bob and B is not Bob) ⇒ B is definitely not Bob.

Let us call the one found out as not-Bob in previous step as P and the other two as Q and R.

To P: If I ask you "Is Q Bob?", will you tell me "yes"?

Case "Yes":
Q is Bob.

To R: If I ask you "Are you God", will you tell me "yes"?

Case "Yes":
R is God. P is devil.

Case "No":
R is devil. P is God.

Case "No":
R is Bob.

To Q: If I ask you "Are you God", will you tell me "yes"?

Case "Yes":
Q is God. P is devil.

Case "No":
Q is devil. P is God.

#### Susam Pal from cotpi added:

Here is a simpler solution. Let the entities be A, B and C. He can ask A, "Is B less likely to give a wrong answer than C?" If the answer is "yes", B is not Bob. If the answer is "no", C is not Bob.

Next, he can ask the entity he knows is not B, "Is 1 + 1 = 2?" If the answer is "yes", he is God. If the answer is "no", he is the Devil.

Then he can ask the same entity, "Is A Bob?"

#### Ryan Batterman solved this puzzle:

I think this is a fairly unorthodox way to solve this problem.

Consider: "Will you answer 'false' to this question?" God, who only speaks the truth, cannot respond to this question. Answering "true" makes a contradiction (because he didn't answer "false") as does answering "false". Thus, we ask the first two people this question, and the fact they can respond indicates that they are not God. We then ask the 3rd person (God), "Is the second person the devil?". The affirmative indicates that the 2nd person is the devil (1st is the idiot); negative that 2nd is random, 1st is devil.

If the first or the second person doesn't answer, you know he's God. Then (since you have more questions & can ask the same person multiple questions), you ask him whether the next person is the Devil or not.

### Credit

This puzzle is taken from folklore.