Fog Creek Software
Discussion Board




chinese emperor

Has anyone got an answer to this question? The link is http://www.techinterview.org/Puzzles/fog0000000031.html

I've been trying to list down all the possibilities but it seems like the last one to guess will never be sure of the answer if the first and second ones are both having white balls.

cyw
Wednesday, April 07, 2004

If [1] and [2] have white hats and it's [3]'s turn, he will shout "My hat is white."

Why? Because if [3]'s hat were black, [2] would have known that his ([2]'s) hat is white.

And why that? Because if [3]'s hat were black, and [2]'s hat were black, [1] would have said "My hat is white."

Why? Because there are only two black hats total.

The trick in these questions is that you have to deduce something from the fact that somebody else couldn't deduce anything.

Vigor
Thursday, April 08, 2004

I just noticed that they are "wearing" balls, not hats. Doesn't change the logic, though.

Vigor
Thursday, April 08, 2004

well Here Is the Complete Solution

there are Three Cases

B - Black Ball
W - White Ball

1.  BBW
2. WBW
3. WWW

now the trick is to solve the problem in 3 rounds

Case I

BBW (Answered in 1 Round)
in round 1 person who sees two BB on other 2 person head will shout that i have a white ball on my head
since its only the round1 and 1 person has said that he has a white ball will make other 2 persons sure that they have black balls on thier head

CASE II

BWW(Answered in 2nd round)

in round 1 all person will pass there turn
now since all have passed there turn so the CASE BBW is not there
now in 2nd round when a person sees BW balls on other two person he will say that i have a White Ball on my head and then the next person who sees BW ball will say W and
the last person left will say B

CASE III
WWW(answered in 3rd round)
in round 1 and 2 all will pass there turn  because they will see WW on others head and wont be able to conclude anything since nobody concluded anything in 2 round that means all of them have white ball

BondOfUk
Sunday, April 11, 2004

If Sage 1 sees 2W,3W Then he can tell nothing
If Sage 1 sees 2W,3B Then he can tell nothing
If Sage 1 sees 2B,3W Then he can tell nothing
If Sage 1 sees 2B,3B Then he can tell 1 must have W

If Sage 2 sees 1W,3W Then he can tell nothing
If Sage 2 sees 1B,3W Then he can tell nothing
If Sage 2 sees 1B,3B Then he can tell 2 must have W
If Sage 2 sees 1W,3B Then he can tell 2 must have W

(since the only case where 3 could have black from person 1's analysis is where 2 has W or where 1 would know his color)


Sage 3 doesn't even need to look, he knows the only case 1 or 2 wouldn't know what color they had is where he has White.

Manfred
Tuesday, April 20, 2004

*  Recent Topics

*  Fog Creek Home