# The Eight Spirits

After your ordeal with the enterpeton, you need the toilet. Unfortunately, your ability to urinate has been stolen by one of the octangular spirits, a set of spirits that follow strange rules. The rules are set out below:

Spirit Yes Unknown No
Sky Yes Yes Yes
Swamp Yes Yes No
Fire Yes No Yes
Lightning Yes No No
Wind No Yes Yes
Water No Yes No
Mountain No No Yes
Earth No No No

The spirits will only answer yes-no questions, but multiple spirits can be asked at once. They are not very intelligent, and know nothing besides each-other's identities and activities. You, on the other hand, can't identify any of the spirits, least of all in your current state.

What is the lowest number of questions required to find the thief?

• If I understand this correctly, the table shows the responses to yes/no questions depending on the actual answer, correct? Aug 5, 2021 at 13:34
• @BeastlyGerbil Yes Aug 5, 2021 at 13:36

I will refer to the spirits with their response values to true/unknown/false -- for instance, YNY is the fire spirit.

Assuming that they can parse arbitrarily complicated questions, I can do this in

a single question!

Here's how:

Is at least one of the following two statements true?
(1) You would answer the same to "Does 1+1=2?" and "Does 1+1=3?", and I have a pet cat.
(2) One of the following two statements is true, but not both:
(2a) You are NNY, NYY, or NYN.
(2b) If you followed the following strategy, you would be assigned "yes": [...]

(I will fill in (2b) later.)

What does this do?

The actual information we're trying to get is in (2b). The rest of the question is "processing" that information in a way that causes each spirit, besides the two constant ones, to follow the strategy correctly. Statements (2) and (2a) flip the result of (2b) only for the second half of the spirits.

Statements (1) and (1a) convert "false" to "unknown", but only for YNY and NYN.
This means that every spirit is "fed" an input that makes them say the actual answer to (2b):

Now, if we give them the strategy, they will follow it - we just have to make them tell us the thief!

So, what is the magical strategy we need to fill in?

First, before the question, we need to line everyone up in a circle.

If the thief is YYY, the spirit to its left says "yes". (If that one is NNN, then the spirit 2 to its left says "yes" instead.) The rest say "no".
Similarly, if the thief is NNN, the spirit to its left says "no" (or if that's not possible, the spirit two to the left does), and the others say "yes".
(These two cases work even with interference by the other constant-output spirit.)

Otherwise:
- If YYY is not directly opposite the thief, then the thief and the spirit opposite YYY say "yes"; the rest say "no".
- Otherwise, the thief and the spirit directly opposite NNN both say "no"; the rest say "yes".

The result of this strategy is that:

If the split is 2 of one answer and 6 of the other, the two will be either adjacent or separated by one; either way, the one on the right is the thief.

Otherwise, the split is 3 of one answer and 5 of the other; the less common answer will have exactly two respondents facing each other, and the thief is the third one.

• The question specifies "They are not very intelligent, and know nothing besides each-other's identities and activities." (for your 2nd spoiler) Aug 5, 2021 at 17:56
• @bobble Yes, I assumed mathematics and pure logic were taken as a given. (Taking the statement fully literally, they would not know the meaning of "and" and "or", or language itself, and so asking any complicated question would be impossible.)
– Deusovi
Aug 5, 2021 at 18:00
• @Deusovi: Rot13(Juvyr guvf zvtug erdhver n dhrfgvba gung vf "nflzzrgevpny" be bgurejvfr htyl, V'z abg pyrne ba jul bayl 1-7 lrfrf ner cbffvoyr, engure guna 1-8). Can you please expand on why this solution is optimal? Aug 5, 2021 at 18:01
• @Brian You can't get 8 "yes"es because one spirit always answers "no". (Though I'm no longer convinced this is optimal - I believe I have a way to do this in one question.)
– Deusovi
Aug 5, 2021 at 18:04
• @Deusovi: Oh right, I'm an idiot. However, Rot13(lbhe cerivbhf bcgvznyvgl pynvz nffhzrf gung gur ahzore bs lrfrf frcnengrf bhg gur pubvprf. Ubjrire, obgu gur ahzore bs lrfrf NAQ juvpu fcvevgf nafjre lrf obgu cebivqr vasbezngvba.). Aug 5, 2021 at 18:09