classic hat problem

There are four man standing in front of a firing-squad. Two of them (nr.1 & 3) wear a black hat and two of them (nr.2 & 4) wear a white hat. They are all facing the same direction and between nr.3 and nr.4 stands a brick wall (see picture). So nr.1 can see nr.2 & 3, nr.2 sees nr.3, nr.3 sees only the wall and nr.4 doesn't see a thing. The men know that there are two white and two black hats.
The commander of the firing-squad is willing to let the men go if one of them can say what color hat he is wearing. The men are not allowed to talk. The only thing they may say is "I'm wearing a white/black hat". If one of the men knows which hat he is wearing he must tell it and all men will be free.
Which man knows 100% sure what color hat he's wearing?


  1. Are you looking for a computer algorithm to find the solution? If so, realize that the crossing can be accomplished if:

    A. Two people cross together (making 2 on the original side and 2 on the destination side).
    B. One of them returns (making 3 and 1).
    C. Two people cross (making 1 and 3).
    D. One returns (making 2 and 2).
    E. The remaining 2 people cross (making 0 and 4).

    You can try all possible combinations with a few nested loops and if-statements to identify who transits on each step A-E above. Once you have tried all combinations and know what the minimum time is, another pass through the loops will allow you to print the transit history corresponding to the minimum time.

    If you don't want an algorithmic solution, just notice that 17 minutes is achieved if 1 and 2 cross, 1 returns, 5 and 10 cross, 2 returns, and finally 1 and 2 cross. Or reverse the order of the transits.

  2. @dave i think u have posted the solution in different problem.
    this might be solution for cross the bridge.

  3. no 2 knws the clour of his hat...


Post a Comment

Popular posts from this blog