*
The moose likes Programming Diversions and the fly likes The Prisoner's Dilemma Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "The Prisoner Watch "The Prisoner New topic
Author

The Prisoner's Dilemma

HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
The Prisoner's Dilemma

A prisoner is given 2 bowls, 100 red balls, and 100 white balls. He is told to divide all the balls between the two bowls any way he wishes, as long as there's at least 1 ball in each bowl. When the executioner comes in, he will reach into a random bowl and draws out a ball. If it is red, the prisoner dies. If it is white, he goes free.
How should the prisoner fill the bowls to give him the best chance of going free?
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
All I can think of is that he should put 100 red balls in one bowl and 100 white balls in the other. That should give him a 50-50 chance to be set free.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Put 1 red ball in bowl A, and all others in bowl B. Then
P(A) = chance of choosing bowl A = 1/2
P(B) = chance of choosing bowl B = 1/2
P(R|A) = chance of drawing red, if A was chosen = 1
P(R|B) = chance of drawing red, if B was chosen = 99/199
P(freedom) = P(R) = P(R|A)*P(A) + P(R|B)*P(B) = 1*(1/2) + (99/199)*(1/2) = 298/398 ~= 74.87%


"I'm not back." - Bill Harding, Twister
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404

Put 1 red ball in bowl A, and all others in bowl B.
Surely 1 white ball in bowl A, and 100 red balls and 99 white balls in bowl B ?
[ February 13, 2004: Message edited by: HS Thomas ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Yeah, something like that.
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Right, the executioner picked a red ball, but with a twisted sense of humur has decided on an unexpected hanging.
The prisoner is told that he will be hanged on some day between Monday and Friday, but that he will not know on which day the hanging will occur before it happens. He cannot be hanged on Friday, because if he were still alive on Thursday, he would know that the hanging will occur on Friday, and thus couldn't be hanged on Friday. He cannot be hanged Thursday for the same reason, and the same argument shows that he cannot be hanged on any other day either. Nevertheless, the executioner unexpectedly arrives on some day, surprising the prisoner.
What day was it?
[ February 16, 2004: Message edited by: HS Thomas ]
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11256
    
  16

It would seem the executioner can now pretty much show up any day he feels like. the prisoner is convinced he will never be hung, so will not be expecting a hanging on any day.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
There is that , and then there's :
in Robert Louis Stevenson's "bottle imp paradox," in which you are offered the opportunity to buy, for whatever price you wish, a bottle containing a genie who will fulfill your every desire. The only catch is that the bottle must thereafter be resold for a price smaller than what you paid for it, or you will be condemned to live out the rest of your days in excruciating torment. Obviously, no one would buy the bottle for 1� since he would have to give the bottle away, but no one would accept the bottle knowing he would be unable to get rid of it. Similarly, no one would buy it for 2�, and so on. However, for some reasonably large amount, it will always be possible to find a next buyer, so the bottle will be bought (Paulos 1995).
They are both, supposedly, examples of Sorites Paradox :
Sorites paradoxes are a class of paradoxical arguments also known as little-by-little arguments. The name "sorites" derives from the Greek word soros, meaning "pile" or "heap." Sorites paradoxes are exemplified by the problem that a single grain of wheat does not comprise a heap, nor do two grains of wheat, three grains of wheat, etc. However, at some point, the collection of grains becomes large enough to be called a heap, but there is apparently no definite point where this occurs.
[ February 16, 2004: Message edited by: HS Thomas ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: The Prisoner's Dilemma