The Prisoner's Dilemma is a well known game. The basis is very simple: two prisoners are being questioned for a crime and have the choice to either COOPERATE with the other prisoner, or to DEFECT. If they both cooperate, they both get the REWARD (3 points). If they both defect, they both get the PUNISHMENT (1 point). The juicy part is if one defects, while the other cooperates. In this case the defectors gets the TEMPTATION (5 points), while the cooperator gets the SUCKER'S PAYOFF (0 points).
An actor participating in the Prisoner's Dilemma we will call an Agent:
public abstract class Agent {
public final int TEMPTATION = 5;
public final int REWARD = 3;
public final int PUNISHMENT = 1;
public final int SUCKERS_PAYOFF = 0;
private String name;
private int score = 0;
public Agent(final String name) { this.name = name; }
public abstract boolean cooperate(final Agent other);
public String getName() { return this.name; }
public void remember(Agent other, boolean cooperates) {
// ignore
}
public int dealWith(Agent other) {
boolean iCooperate = this.cooperate(other);
boolean otherCooperates = other.cooperate(this);
int score = iCooperate == otherCooperates ?
(iCooperate ? REWARD : PUNISHMENT) :
(iCooperate ? SUCKERS_PAYOFF : TEMPTATION);
increaseScore(score);
remember(other, otherCooperates);
return score;
}
public void increaseScore(final int score) { this.score += score;}
public int getScore() { return this.score; }
public void resetScore() { this.score = 0; }
}
The first type of Agent will be the Dove. The Dove will always cooperate, hoping they will be reciprocated:
public class Dove extends Agent {
public Dove(final String name) { super(name); }
public boolean cooperate(final Agent other) {
return true;
}
}
The second type of Agent is the Hawk. Hawks always aims for the win-lose, hoping that the other is more cooperative:
public class Hawk extends Agent {
public Hawk(final String name) { super(name); }
public boolean cooperate(final Agent other) {
return false;
}
}
Pitch these two types of agents against each other and it will not be a surprise that the Hawk in every encounter scores the Temptation, while the Dove gets the Sucker's Payoff.
This is proven in a test setup, simulating the Arena of Evolution. In the setup the worst scoring Agent gets eliminated randomly spawning a new Agent in its place. The type of the new Agent is randomly determined and based on the number of Agents of a certain type. For example, if there are 12 Doves and 8 Hawks, the new Agent has a 60% chance of becoming a Dove and a 40% chance of becoming a Hawk.
You can let the agents interact in the following way:
agentOne.dealWith(agentTwo);
agentTwo.dealWith(agentOne);
The Doves simply get supplanted.
It was long thought that the Hawk had the dominant strategy. But luckily for those who fear such a bleak outcome, a new type reversed the social order from a Malthusian one to a more friendly one -- enter Tit-for-Tat:
import java.util.*;
public class TitForTat extends Agent {
private Map
public TitForTat(final String name) { super(name); }
public boolean cooperate(final Agent other) {
Boolean cooperate = iKnowWhatYouDidLastTime.get(other.getName());
return cooperate == null ? true : cooperate;
}
public void remember(Agent other, boolean cooperates) {
iKnowWhatYouDidLastTime.put(other.getName(), cooperates);
}
}
Tit-for-Tat will remember what an Agent did the last time it was encountered. If it cooperated, so will Tit-for-Tat. If it defected, Tit-for-Tat will pay in kind and defect also. But it keeps a positive attitude to the social traffic by always cooperating if it does not know whom it is dealing with.
What happens now depends a lot on the number of interactions that take place and if there is a large enough population of Doves/Tit-for-Tats so that the good guys can deal positively with each other. If both preconditions are in place, the Hawks are supplanted by Tit-for-Tat. Conversely, if Tit-for-Tat is pitched in a Dove population, both will flourish.
If you are interested in this type of material, I can heartily recommend The Origins of Virtue by Matt Ridley.
On a closing note, there is a type following Tit-for-Tat, which has a bit of a mean streak (its name is "Pavlov"), trying to take advantage of Doves (ie, "suckers") while being on its guard against Tit-for-Tat. This type has quite a ball in a mixed Dove/Tit-for-Tat population.
Doves get pissed on by Pavlov, while the Hawks take a piss on everyone -- the prophetic words uttered in Team America never sounded more true:
"We're dicks! We're reckless, arrogant, stupid dicks. And the Film Actors Guild are pussies. And Kim Jong Il is an asshole. Pussies don't like dicks, because pussies get fucked by dicks. But dicks also fuck assholes: assholes that just want to shit on everything. Pussies may think they can deal with assholes their way. But the only thing that can fuck an asshole is a dick, with some balls. The problem with dicks is: they fuck too much or fuck when it isn't appropriate - and it takes a pussy to show them that. But sometimes, pussies can be so full of shit that they become assholes themselves... because pussies are an inch and half away from ass holes. I don't know much about this crazy, crazy world, but I do know this: If you don't let us fuck this asshole, we're going to have our dicks and pussies all covered in shit!"
Quod Erad Demonstratum
No comments:
Post a Comment