An Introduction
Many of you will be familiar with the famous game/paradox Prisoner's Dilema which is almost invariably used as an example when begining to understand game theory but for those that are not the Prisoner's Dilema goes as such:
"Two suspects are arrested by the police. The police have insufficient evidence for a conviction, and, having separated both prisoners, visit each of them to offer the same deal. If one testifies (defects from the other) for the prosecution against the other and the other remains silent (cooperates with the other), the betrayer goes free and the silent accomplice receives the full 10-year sentence. If both remain silent, both prisoners are sentenced to only six months in jail for a minor charge. If each betrays the other, each receives a five-year sentence. Each prisoner must choose to betray the other or to remain silent. Each one is assured that the other would not know about the betrayal before the end of the investigation. How should the prisoners act?"
On first consideration the answer seems obvious because they would be both better off if they remained silent. However, as there is no garuntee between the prisoners and they can't communicate because they have been seperated each must act in their own interest. The 'answer', or rather the solution attained from the Nash Equilibrium, is that they should always defect.
This is because when choosing to remain silent the possibilities are that they serve 6 months (or s 0.5 years) or serve 10 years in jail which totals 10.5 years - an average of 5.25. On the other hand, if they choose to defect they may spend 5 years in jail but they may also walk free (0 years) so it totals only 5 years - an average of 2.5. So, assuming that both prisoners are logical, they will both end up spending 5 years in jail where they could have spent 6 months!
Of course, all of what has been written above is theoretical and in real life there would be many other factors which would contribute to the decision (personal intregity?) but we are going to test this theory that it always best to defect, but rather than using real-life cases, we're going to use our programming experience.
Testing our theory
We are going to create two players, both of them computer controlled, who will pick to defect or co-operate randomly but at probabilities which we specify - this way we can make one nice player and one harsh player and see who prospers. If this game was only played the once it would not reflect the true outcomes of different 'personalities' so we are going to have our players repeatedly play the game over 1000 times.
Posted below is the commented code which i created as an adequete demonstration
Wednesday, 22 April 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment