# Multi-variable hat guessing

Puzzling Asked on January 4, 2022

Here is a variation of the hat-guessing logicians problem.

100 logicians are given hats. They know that:

1. All the hats are either black or white
2. Each hat may or may not have green stripes on it
3. Each hat may or may not have a pompom on top
4. At least one of them will be wearing a black hat with green stripes and a pompom

As usual, each logician can see everyone else’s hat but not their own. The logicians may discuss strategy before they are given hats, but may not talk to each other afterwards. Once every five minutes after they’ve been given hats, any logicians who want have a chance to state what they believe their hats to be like (black or white, striped or not, with or without a pompom.) If all the logicians eventually figure out what their hats are like, they win. But if any of them are ever wrong about their hats, they all lose. What strategy should they use to all figure out their hat type in the shortest amount of time?

I do have a solution to this, but I don’t know if it’s the optimal one.

Also, bonus if anyone can come up with a strategy that works even without the logicians knowing 4).

Well, the first step will have to be

with an extra modification to encode information in the timing of the guess.

To include information in the guess timing, the logician calculates

Then, whenever a logician knows their own hat colour, they

which is how the information gets conveyed.

Once a guess with this information has been taken, every logician can instantly deduce their own hat type (there's only one hat type they can have that makes all the parities match), so we only need to ensure the first guess is correct:

This is slow, because the first guess will only happen after

but I couldn't come up with a more efficient approach off the top of my head. (Hehe.)

EDIT: Here's what I believe to be the quickest possible guaranteed-win strategy:

Timing:

• Tick - how many 5-minute periods have passed

Situation:

• BSP Hats - total number of black hats with stripes and pompoms
• B Parity - 1 if the number of black hats seen by the guesser(s) is odd
• S Parity - 1 if the number of striped hats seen by the guesser(s) is odd
• P Parity - 1 if the number of pompom hats seen by the guesser(s) is odd

Who should guess:

• Guesser 1 - Counting from John leftwards, the 1st person that has a BSP hat
• Guesser 2 - Counting from John leftwards, the 2nd person that has a BSP hat
• Guesser 3 - Counting from John leftwards, the 3rd person that has a BSP hat
• Guesser 4 - Counting from John leftwards, the 4th person that has a BSP hat

(Decide beforehand, who is "John", and arrange the logicians to a circle before the game starts.)

On any tick, the dedicated guessers know which guesser they are. (This is the important bit that allows a solution to exist in the first place.)

From the guesser information, and the tick number, everyone can work out which situation they are in, and from the situation, everyone can deduce their own hat type.

Since this method enumerates every possible case, it will always work. It is also optimal in the sense that apart from correct guesses, no other information can be passed, and this scheme uses all the possible guess patterns to mean something different. (I'm assuming that a logician isn't allowed to "cheat the system" by guessing correctly more than once, which could shave off another couple of rounds.)

With this method, the logicians will win no later than on round N+11, where N is the total number of the special Black-Stripes-Pompom hats.

Answered by Bass on January 4, 2022