Wednesday, February 23, 2005

The beautiful solution

Solution 1 is not really the best solution but nevertheless if it was somehow used, could possibly allow all the dwarves to be set free by the 2nd day in the worst case scenario.

Two dwarves start off by falling in the parade square. A third dwarf takes a look at them and if they are the same, he falls in at the side. If they are different, he falls in between them. Hence he always separates the 2 groups of dwarves, dotted and undotted. Going by this logic, the dwarves do not need to communicate but it does require the first few dwarves to take some initiative. So extending this argument, by the time the last dwarf falls in, there are 2 clear cut groups and he falls in between the 2 groups and he takes a 50% chance by putting up his hand. If it is wrong, he will leave his hand down on day 2 and the dwarves will be set free!

Smart solution!

Solution 2 is the 'zai' solution as Henry and I both agree, it took our brains a bit of warming up to understand it at first! Even now I also a bit blur so I shall just copy and paste the email haha!

Ok, the one dotted dwarf case is trivial:

The dotted dwarf himself sees no other dotted dwarf, and realized that he
must be the one, so he raised his hand.


Two dotted dwarves case:

[from a dotted dwarf eyes] he sees one dotted dwarf in the group. But that
dotted dwarf is NOT raising his hand as in case 1! Why didn't he raise his
hand when it seems that he is the only dotted dwarf?

So, there must be one more dotted dwarf than what he actually sees. Since
he can see everyone except himself, the "one more dotted dwarf" must be
himself.


[from non-potted dwarves point of view] they saw two dotted dwarves. They
also suspect that they themselves are dotted. So they observe the two
dotted dwarves. If there ARE REALLY TWO dotted dwarves, then, by day 2,
those two dwarves will put up their hand. Case closed.


(Stepping immediately to a sample case)

OK, I am a dwarf. I see 2 dotted dwarves. I assume that I am not dotted
(I don't know whether I am really dotted or not). So, I asumme that the 2
dotted dwarves that I saw are really the total number of dwarves. So I
wait 2 days. By right, If there really 2 dotted dwarves in the group, they
will know that by day 2, from previous argument.

If by day 2, the two dwarves that I saw really raise their hand, and the
king release us, then I know that the are really 2 dwarves in the group.

But what if the 2 dwarves didn't put up their hands? WTF are they doing?
Assuming they are not blur, the only possiblity is that there are actually
more than 2 dwarves!! But I see only 2, so I must be the third.

At the same time the non-dotted dwarf always sees ALL the three dotted
dwarves.

So, a dotted dwarf himself will always be the one who realized that he is
dotted, if by day r, the r dotted dwarves he sees did not raise their
hands. They are waiting for him! (Each dotted dwarf has this view-point
that the remaining dotted dwarves are waiting for him by the end of day r
if they are not released).

No comments: