As you're walking through the city, a wandering street logician pulls you aside. "Hey, you. Want to play a game?" He rasps in a loud whisper. You, being quite the logician yourself, oblige. He leads you through a dark, winding alley, eventually ending at a secluded, run-down storage locker. Shuffling a bit, he unlocks the rusty door and opens it with a loud creak, revealing darkness behind it. He gestures you forward, and you step in. As your eyes begin to adjust to the darkness, you jolt as the door slams shut behind you. No sooner has it shut than the lights turn on, revealing six hats of different colors, placed on stools. Taking a quick inventory, you note that the hats in order from left to right are Red, Blue, Yellow, Green, Orange, and Purple.
"So here's the game," the logician wheezes. "As of now, you are trapped in this locker with me. The only way I'll let you out is if you can follow the Magical Hats! I'm going to shuffle the hats, then give you clues about their whereabouts. If you can correctly identify where each hat has finished, you with obtain your freedom, as well as the hat of your choice! Incorrectly identify the hats, well...let's just say I hope you correctly identify the hats."
You flex your brain muscles. Time to play hardball.
The logician lets a drape loose, shielding the hats from your view. He runs behind the drape and begins frantically moving hats around, panting as he runs between stools. For awhile you attempt to track the hats, but you give up as his movement is too erratic to follow. Finally, he stops and comes out from behind the curtain.
"Here's what I have to tell you about the new order of hats," he pants.
- Exactly one hat is in the same place that it started.
- Exactly one pair of hats have swapped places with one another.
- The first three hats in the original display are now in the odd-numbered locations.
- The Red hat moved the undisputed farthest out of all the hats.
- The Blue hat is adjacent to its starting position.
- The Purple hat is now where the Green hat began.
You think for a second, then begin to piece together where the hats are. This is too easy, you muse with a smirk. This logician doesn't know what he has coming. As you put the last piece of the puzzle into place and begin to speak, the logician cuts you off.
"Wait, wait, wait! This is TOO easy!" He shrieks. In haste, he runs behind the curtain and begins shuffling the hats again. You feel your morale break, as everything you had put together has just been shattered. Still, you steel yourself, and prepare for his next challenge.
After an eternity, the logician once again returns from behind the drape. "Okay, this time...this time I have it right," he gasps. "And here are your clues."
- Exactly one hat is in the same place that it started.
- Exactly one hat is in the same place that it was in the previous iteration of hats.
- Exactly one pair of hats have swapped places with one another from the previous iteration of hats.
- All hats that were adjacent to their starting position in the previous iteration of hats are still adjacent to their starting position.
- There is only one set of hats that started adjacent and have remained adjacent.
- The hat on the far left has not been on an end until now.
- The left half and the right half from the previous iteration contain the same assortments of hats.
You take a minute to breathe. Let's see if I can still do this, you wonder as your brain begins to pulse. Just as you begin to unravel the strings of the hat mystery in your mind, the logician shrieks at you.
"WAAAAAAAAAIT!!!!"
Your gears halt. "What?" you spit at the logician angrily. He flinches backwards, then sheepishly admits, "I forgot to tell you about the lucky and unlucky hats."
You groan.
He continues on, "The lucky hat is worth seven million dollars - it's made of quite a rare silk, you see. The unlucky hat, however, will literally kill you instantly if you put it on your head." Before you can posit a conjecture about simply not wearing the hat, he adds, "I of course will not let you leave until you are wearing your selected hat."
How can I possibly know which is which? You think with a furrowed brow. Luckily, he has prepared an answer for that as well. "Unfortunately, I don't remember which hat is which, but I do remember a few things about the hats..."
"...and here's what I remember."
- Of the lucky and unlucky hats, one is a primary color and one is a secondary color.
- At no point while the hats were at rest were the two hats next to one another.
- If the lucky hat is a primary color, then the unlucky hat was never at rest on either end.
- If the lucky hat is a secondary color, then the unlucky hat is yellow.
You wait, as he stands in thought. "No, that's all I remember," he cedes after a few seconds.
You groan again. Time to get to work.
Where were the hats after the first shuffle? Where were the hats after the second shuffle? Finally, when you win the prize and are allowed to leave, which hat do you take with you?