Call the men Andy, Bill and Carl.
They can...
Always answer truthfully (T)
Always answer falsely (F)
Answer randomly (R)
R can either
Answer truthfully (RT) or
Answer falsely (RF)
Assume you are wearing a baseball cap.
1. Ask Andy "Am I wearing a baseball cap?"
If he answers "yes", then he is either T or RT.
If he answers "no", then he is either F or RF.
If Andy answered "yes" to question 1, then.
2a. Ask Andy "Is exactly one of the following statements true?
a. You are the one who always tells the truth.
b. I am wearing a baseball cap.
c. You are lying."
If Andy = T, then the correct answer is "no" (both a. and b are true) and he will answer truthfully and say
"no".
If Andy = RT, then the correct answer would be "yes" (only b. is true) and he will answer truthfully and say
"yes".
If Andy = RF, then the correct answer would be "no" (both b. and c. are true), but he would lie and say
"yes".
If Andy answered "no" to question 1, then
2b. Ask Andy "Is exactly one of these statements true?
a. You are the one who always lies.
b. I am wearing a baseball cap.
c. You are telling the truth.
If Andy = F, then the correct answer is "no" (both a. and b are true) but he will lie and say
"yes".
If Andy = RT, then the correct answer would be "no" (both b. and c. are true) and he will answer truthfully and say
"no".
If Andy = RF, then the correct answer would be "yes" (only b. is true), but he would lie and say
"no".
If Andy answered "yes" to question 1 and "yes" to question 2a, then he is the one who answers randomly.
3a. Ask Bill "Am I wearing a baseball cap?"
If Bill = T, then he will answer truthfully and say "
yes".
If Bill = F, then he will lie and say "
no".
If Andy answers "yes" to question 1 and "no" to question 2a, then he is the one who always tells the truth.
3b. Ask Andy "Is Bill the one who always lies?"
If Bill = F, then Andy will answer truthfully and say "yes".
If Bill = R then Andy will answer truthfully and say "no"
If Andy answers "no" to question 1 and "yes" to question 2b ,then he is the one who always lies.
3c. Ask Andy "Is Bill the one who always tells the truth?"
If Bill = T, then Andy will lie and say
"no".
If Bill = R, then Andy will lie and say
"yes".
If Andy answered "no" to question 1 and "no" to question 2b, then he is the one who answers randomly.
3d. Ask Bill "Am I wearing a baseball cap?"
If Bill = T, then he will answer truthfully and say
"yes".
If Bill = F, then he will lie and say
"no".
4. Ask yourself "Am I confused yet? "
If you answered question 4 "no", then congratulations are in order. Keep going.
If you answered question 4 "yes", then go get a strong dose of caffeine or other stimulant to keep you alive through the rest of this post, and a couple of aspirins for later.
Here are the results...
Question 1 - YES
Question 2a - YES
Question 3a - YES
Andy = R
Bill = T
Carl = F
Question 1 - YES
Question 2a - YES
Question 3a - NO
Andy = R
Bill = F
Carl = T
Question 1 - YES
Question 2a - NO
Question 3 - YES
Andy = T
Bill = F
Carl = R
Question 1 - YES
Question 2a - NO
Question 3b - NO
Andy = T
Bill = R
Carl = F
Question 1 - NO
Question 2b - YES
Question 3c - YES
Andy = F
Bill = R
Carl = T
Question 1 - NO
Question 2b - YES
Question 3c - NO
Andy = F
Bill = T
Carl = R
Question 1 - NO
Question 2b - NO
Question 3d - YES
Andy = R
Bill = T
Carl = F
Question 1 - NO
Question 2b - NO
Question 3d - NO
Andy = R
Bill = F
Carl = T
Congratulations for making it to the end. Have some more caffeine.
The TOG