[net.puzzle] hat puzzle **SPOILER**

ccc@bu-cs.UUCP (02/10/86)

>     Three men are in a room. The room has no mirrors and the three men
>are in a straight line such that the person in the back of the line
>can see the two people in front of him, the middle person can see
>only the person in front of him, and the person in front can't see
>anyone. Another person walks in with a bag containing 3 black hats
>and two red hats. The man pulls three hats at random out of the bag
>and places them randomly on the three men. He walks out of the room.
>The man in the back says,"I don't know what color hat I'm wearing."
>The man in the middle says,"I don't know what color hat I'm wearing, either."
>Now tell me what color hat the man in the front of the line is wearing
>and why.

There are four cases for the permutations of hats among the man in
the front (F) and the man in the middle (M):

1) F - red, M - red;
2) F - red, M - black;
3) F - black, M - black
4) F - black, M - red.

1) If both were wearing red, then the Man in the Back would know he
   was wearing a black hat.  No good.

2) M now knows that he and F share at most one red hat between them;
   if F has it, then he knows he has black; but he doesn't know.

This leaves cases 3 or 4 in which F must be wearing a black hat.


-- 
Cameron C. Carson
Distributed Systems Group
Boston University ACC

UUCP: ...!harvard!bu-cs!ccc
ARPA:  ccc%bu-cs@csnet-relay.arpa