in reply to Re: Suggestions for writing a Perl application
in thread Suggestions for writing a Perl application

Well, the solution is fairly simple, if you can assume the convicts are smart (which is quite bold), and they have a similar sense of "how long it would take to figure out a logic problem".

The solution is that if two convicts wear a black disk, the third convict knows he has a white disk. But from looking at the backs of the other convicts, the convicts know that there is at most one black disk - and if there's a black disk, it's on their back, and the others see a white and a black disk. However, since noone leaves right away, the ones seeing a black and a white disk will conclude their disk must be white - there cannot be two black disk, and they can leave. But this also doesn't happen, so the premises that one's disk is black is false, ergo, everyone has a white disk.

But as I said, there's a timing problem, and the assumption the others are smart. Usually, this question is asked with perfect logican getting hats or disks to wear, and there is some timing mechanism (for instance, each of them is asked a question in a particular order).

I don't really see a way of demonstrating this puzzle in Perl.

Abigail

  • Comment on Re: Suggestions for writing a Perl application

Replies are listed 'Best First'.
Re: Re: Suggestions for writing a Perl application
by jacques (Priest) on Sep 10, 2003 at 05:55 UTC
    I don't really see a way of demonstrating this puzzle in Perl.

    An algorithm should do it. The puzzle is a well-known one. Logical time is divided into three moments.

    1. the instant of seeing
    2. the time for understanding
    3. the moment of concluding

    The first prisoner to deduce the color of the disk on his own back will be granted his freedom. The correct deduction appears to depend on the hesitation of the group. "If I had a black disk, then each of the other prisoners would not hesitate to deduce immediately that he was white. Since neither has done so, I must also have a white disk." In fact, this puzzle would make a nice Perl game.