Prisoner's Dilemma
I am a C++ student working on a project involving the "Prisoner''s Dilemma". (In case you are not familiar with the Prisoner''s Dilemma, it is a concept where there are 2 prisoners in separate rooms who have a choice to confess or not, and they don''t know what the other is going to do.) I am trying to develop a strategy that will provide beneficial results no matter what the other prisoner says. Confessing and not confessing bring different penalties (in number of years for the sentence), and what the other prisoner does (confess or not) has an impact on your outcome. Anyway, we are not allowed to change the main (driver) program - only our Strategy class. The only thing that is passed into our class is the number of years we are receiving for our sentence. I''m not sure how I can develop a strategy by only knowing my penalty and not knowing what the other prisoner did the previous time the game was played. The game is played 100 times, and the total sentences are totalled and compared with the other prisoner. I was wondering if anyone has experience with this game (it''s supposed to be a popular teaching tool). If so, let me know. Thanks.
Actually, I''ve read an article in a magazine (New Scientist I think) about giving gifts and stuff like that, and the prisoner example was used, and I believe, it is always best to stay silent (ie give a gift to your fellow prisoner) although I it may change depending on the sentence.
Anyway, onto the proper stuff...
Ok, it is just a probability thing, so work it out like this:
There are two possible options for the other prisoner to take, confess (C) or not confess (N).
You can also confess (C) or not confess (N)
So the possibilites are this:
NN - Neither confess. Both win
NC - Other guy confesses. You lose
CN - You confess. You win
CC - Both confess. Both lose (I assume)
What you need to do, is give each of those combinations a score, since you haven''t mentioned the exact scores for each, you should do that yourself, all it is is how many years you get if you do that option.
Then you will have 4 options, each with scores:
NN - w
NC - x
CN - y
CC - z
You can control which option happens first, but not the second one, assume that there is an equal chance of them Confessing or Not. So check what could happen if they don''t confess, either you get w years or you get y, which one of them is better? And by how much?
Now check what would happen if they did confess, you could either get x years or z years. Which is better and by how much?
I hope you see where that is taking you. Since I must be going now. It shouldn''t be too hard to see what happens.
"Only a fool quotes himself"
Andy Owen
My Homepage (Non games related)
My Current Project (Games related... I think)
Anyway, onto the proper stuff...
Ok, it is just a probability thing, so work it out like this:
There are two possible options for the other prisoner to take, confess (C) or not confess (N).
You can also confess (C) or not confess (N)
So the possibilites are this:
NN - Neither confess. Both win
NC - Other guy confesses. You lose
CN - You confess. You win
CC - Both confess. Both lose (I assume)
What you need to do, is give each of those combinations a score, since you haven''t mentioned the exact scores for each, you should do that yourself, all it is is how many years you get if you do that option.
Then you will have 4 options, each with scores:
NN - w
NC - x
CN - y
CC - z
You can control which option happens first, but not the second one, assume that there is an equal chance of them Confessing or Not. So check what could happen if they don''t confess, either you get w years or you get y, which one of them is better? And by how much?
Now check what would happen if they did confess, you could either get x years or z years. Which is better and by how much?
I hope you see where that is taking you. Since I must be going now. It shouldn''t be too hard to see what happens.
"Only a fool quotes himself"
Andy Owen
My Homepage (Non games related)
My Current Project (Games related... I think)
Trying is the first step towards failure.
September 18, 2000 10:31 AM
The problem with my strategy development process is that the sentence terms may vary. And since the only thing being passed into my strategy class is the number of years i''m getting for my sentence, I''m not sure how to go about determining what I should do next time. It would be easier if I knew what the other prisoner was going to do this time or what he did last time, but that''s not the case. See where I''m coming from??? I''ll try to find the article you spoke of. Thanks for your help.
Piers Anthony solved this question nicely in "Golem in the Gears." The main strategy was to always be nice to the other guy first off (i.e. don''t rattle), and then do whatever he does to you. Of course, this might not work with your program, but best of luck and I hope this helps.
WhoopA, the Official Kicker of Butts
--- Home Page, visit at your own risk!
The future is not set. There is no fate, but what we make of ourselves.
Everywhere I look, I see rabbits. Maybe I should take down all my Sailor Moon stuff.
WhoopA, the Official Kicker of Butts
--- Home Page, visit at your own risk!
The future is not set. There is no fate, but what we make of ourselves.
Everywhere I look, I see rabbits. Maybe I should take down all my Sailor Moon stuff.
WhoopA, the Official Kicker of Butts--- Where have I been all these years?
Questions:
If you confess, is the sentence reduced?
If both people confess, is the sentence still reduced?
If both don''t confess, do they get no sentence?
If the amount the sentence is reduced by is a constant (eg, if you confess, the sentance is reduced by 50%) then it shouldn''t matter what the sentence is.
Can you see what code the core part is using? If so, you could look at how the other prisoner reacts and then if it is random, then just keep on feeding the same random seed into the random number generator so it will always give the same number =) Maybe not allowed, but you''d be awarded for a creative solution =)
"I'm going to live for ever. Even if I die trying"
Benjamin Franklin (I think)
If you confess, is the sentence reduced?
If both people confess, is the sentence still reduced?
If both don''t confess, do they get no sentence?
If the amount the sentence is reduced by is a constant (eg, if you confess, the sentance is reduced by 50%) then it shouldn''t matter what the sentence is.
Can you see what code the core part is using? If so, you could look at how the other prisoner reacts and then if it is random, then just keep on feeding the same random seed into the random number generator so it will always give the same number =) Maybe not allowed, but you''d be awarded for a creative solution =)
"I'm going to live for ever. Even if I die trying"
Benjamin Franklin (I think)
Trying is the first step towards failure.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement