There are 3 gods, named Past, Present and Future, who all look identical. They sit in a throne room, with one in the middle, the others on the right and left. You are allowed to ask them a series of yes/no questions in order to discern their identities. Present will answer truthfully, Past will truthfully answer the previous question you asked, and Future will truthfully answer the next question you plan to ask.
In order to avoid paradoxes (which would destroy the universe), you must follow these rules:
- You must write down all the questions you plan to ask before entering the throne room, in the order you plan to ask them, and not deviate from this plan.
- The only questions allowed are "Is the statement $P$ true?", where $P$ is a boolean function of statements like "The god at [position] is [name]" or "You are [name]". (Examples: "Are you Future?", "Is the God on the right Past?", "Is the middle God either Past or Present?" "Is one of you or the left god Future?").
- Though what questions you ask must be preplanned, who you ask those questions to may be decided dynamically.
- If your first question is directed at Past, she will answer yes/no randomly. Same when your last question is directed at Future.
- The pronoun "you" refers to the person considering the question, not the person it was originally asked: if you ask Present, "Are you Past?," she will respond "No", and if your next question is directed at Past, she will respond "Yes."
What is the fewest number of questions you must ask to determine their identities, and how do you do this? (There is a solution, and it can proved optimal).
I got this puzzle from William Wu's puzzle website. You may also consider the "time is a flat circle" variant, where Past will answer your last question when your first question is directed at them, and Future will similarly wrap around to the first question you asked.