# Let’s Program A Prisoner’s Dilemma Part 7: Survival of the Fittest

So we’ve built a bunch of different prisoner models and thrown them together in all sorts of different combinations to see what happens. And we could keep doing that.

But isn’t running all these experiments by hand kind of boring? I mean, who really has the time to sit around all day adjusting prisoner ratios and recording results?

Fortunately, as programmers we know that the answer to boredom is automation, so let’s build us a system that can test different prisoner populations for us.

What we’re going to be doing specifically is a simple survival of the fittest algorithm. We’ll still give our program a starting mix of prisoners, but after their first game is done the worst 10% of the prisoners will be removed while the best 10% will be duplicated. This new group will then play the game again. We’ll repeat this pattern a few dozen or hundred times producing all sorts of interesting numbers on what sorts of groups seem to work best.

It Runs In The Family

So what should our new multi-generational code look like?

For starters the main game playing algorithm should stay the same. We’ll still have a group of prisoners that need to be randomly paired up for a certain number of rounds and we’ll still want to keep track of everyone’s score.

The only difference is that at the end of the round instead of just reporting those scores and exiting we’re going to want to generate a new group of prisoners and then run the entire experiment again. We’ll do this for however many generations we think the experiment should run.

So there’s our first hint on what this should look like. Instead of just asking for a group of prisoners and how many rounds they should play we are going to ask for a group of prisoners, how many rounds they should play and how many times (or generations) we should repeat the experiment.

`def playMultiGenerationalPrisonersDilemma(prisoners, generations, roundsPerGeneration)`

Now inside of that we’re going to need a loop that runs once for every generation we asked for. And inside of that loop we’re going to want to copy our existing prisoner dilemma code. Standard Disclaimer: Copying code is sloppy and should be avoided on serious projects. If you were building a professional prisoner dilemma product you would want to figure out some way that playPrisonersDilemma and playMultiGenerationalPrisonersDilemma could both reference the same piece of code instead of copying each other.

Anyways…

```generations.times{ |generation|
#Copy paste our code from the normal playPrisonersDilemma function here
end```

That’s enough to make our code play the prisoners dilemma again and again as many times as we want, but it will use the same group every time. What we want instead is to create a new group based off of the last group but with the bottom 10% of prisoners removed and the top 10% of prisoners doubled. We can do this by adding a little bit of code after the copy pasted dilemma logic, right after the part where it prints out the score.

```#Generate a new group of prisoners based off of the last group.
#Prisoners that scored well get duplicated. Prisoners that scored poorly get dropped

newPrisoners = Array.new
newPrisonerCount = 0
newSaintCount = 0
newDevilCount = 0
newJudgeCount = 0

prisoners.sort{ |x, y| y.score <=> x.score}.each{ |prisoner|
#Top ten percent get an extra prisoner in the next generation
if newPrisonerCount < (prisoners.length / 10).floor
case prisoner.strategy
when "Saint"
newSaintCount = newSaintCount + 1
when "Devil"
newDevilCount = newDevilCount + 1
when "Judge"
newJudgeCount = newJudgeCount + 1
end
end

#Bottom ten percent don't get added to the next generation at all
if newPrisonerCount >= prisoners.length - (prisoners.length / 10).floor
break
end

#If it's not the bottom ten percent add one to the next generation
case prisoner.strategy
when "Saint"
newSaintCount = newSaintCount + 1
when "Devil"
newDevilCount = newDevilCount + 1
when "Judge"
newJudgeCount = newJudgeCount + 1
end

newPrisonerCount = newPrisonerCount + 1
}

#Create new generation and load it into the prisoners variable for the next game
prisoners = createPrisoners(newSaintCount, newDevilCount, newMadmenCount, newJudgeCount)```

Nothing fancy here. We just sort the prisoners and then iterate through them while keeping track of how many prisoners of each type we’ve seen. For the first ten percent of prisoners we count double and we skip the last ten percent entirely.

We then use our good old createPrisoners function to build a new generation of prisoners. Starting with fresh prisoners like this is actually better than trying to modify our old prisoner group because it ensures no lingering data gets left behind to mess things up. For instance, it would be a bad thing if Judge style prisoners kept their memory between matches (especially since IDs might wind up changing between games).

With the new prisoners created the generation loop then repeats and our new group of prisoners play the game again. All that’s left to do is add a nice little message to our score output letting us know which generation we’re on and we have a complete little program.

```def playMultiGenerationalPrisonersDilemma(prisoners, generations, roundsPerGeneration)
if !prisoners.length.even?
throw "Prisoners Dilemma requires an even number of participants"
end

generations.times{ |generation|

# Make sure each prisoner starts out with a clean slate
prisoners.each{ |prisoner| prisoner.score = 0}

roundsPerGeneration.times{
pairs = prisoners.shuffle.each_slice(2)
pairs.each{ |pair|
firstPlayerCooperates = pair[0].cooperate?(pair[1].id)
secondPlayerCooperates = pair[1].cooperate?(pair[0].id)

if(firstPlayerCooperates)
pair[0].score -= 1
else
pair[1].score -= 2
end

if(secondPlayerCooperates)
pair[1].score -= 1
else
pair[0].score -= 2
end

pair[0].learnResults(pair[1].id, secondPlayerCooperates)
pair[1].learnResults(pair[0].id, firstPlayerCooperates)
}
}

#Show the stats for the group as a whole as well as for each individual prisoner
groupScore = 0
prisoners.each{ |prisoner| groupScore += prisoner.score }
puts "In generation #{generation+1} the group's overall score was #{groupScore} in #{roundsPerGeneration} rounds with #{prisoners.length} prisoners"
prisoners.sort{ |x, y| y.score <=> x.score}.each{ |prisoner| prisoner.report }

#Generate a new group of prisoners based off of the last group.
#Prisoners that scored well get duplicated. Prisoners that scored poorly get dropped
newPrisoners = Array.new
newPrisonerCount = 0
newSaintCount = 0
newDevilCount = 0
newJudgeCount = 0
prisoners.sort{ |x, y| y.score <=> x.score}.each{ |prisoner|
#Top ten percent get an extra prisoner in the next generation
if newPrisonerCount < (prisoners.length / 10).floor
case prisoner.strategy
when "Saint"
newSaintCount = newSaintCount + 1
when "Devil"
newDevilCount = newDevilCount + 1
when "Judge"
newJudgeCount = newJudgeCount + 1
end
end

#Bottom ten percent don't get added to the next generation at all
if newPrisonerCount >= prisoners.length - (prisoners.length / 10).floor
break
end

#If it's not the bottom ten percent add one to the next generation
case prisoner.strategy
when "Saint"
newSaintCount = newSaintCount + 1
when "Devil"
newDevilCount = newDevilCount + 1
when "Judge"
newJudgeCount = newJudgeCount + 1
end

newPrisonerCount = newPrisonerCount + 1
}

#Create new generation and load it into the prisoners variable for the next game
prisoners = createPrisoners(newSaintCount, newDevilCount, newMadmenCount, newJudgeCount)
}
end```

Me, Papa and Granpappy

Now let’s give our code a whirl. For testing purposes I’m going to create a small 10 prisoner group and have it run for a mere three generations.

```prisoners = createPrisoners(2, 3, 3, 2)
#playPrisonersDilemma(prisoners, 1000)
playMultiGenerationalPrisonersDilemma(prisoners, 3, 1000)```

In generation 1 the group’s overall score was -15444 in 1000 rounds with 10 prisoners

ID: 5 Score: -1176 Strategy: Devil

ID: 3 Score: -1190 Strategy: Devil

ID: 4 Score: -1192 Strategy: Devil

ID: 9 Score: -1495 Strategy: Judge

ID: 10 Score: -1505 Strategy: Judge

ID: 6 Score: -1589 Strategy: MadMan

ID: 8 Score: -1616 Strategy: MadMan

ID: 7 Score: -1639 Strategy: MadMan

ID: 1 Score: -1994 Strategy: Saint

ID: 2 Score: -2048 Strategy: Saint

In generation 2 the group’s overall score was -16716 in 1000 rounds with 10 prisoners

ID: 4 Score: -1440 Strategy: Devil

ID: 3 Score: -1444 Strategy: Devil

ID: 5 Score: -1448 Strategy: Devil

ID: 2 Score: -1498 Strategy: Devil

ID: 10 Score: -1602 Strategy: Judge

ID: 9 Score: -1629 Strategy: Judge

ID: 7 Score: -1793 Strategy: MadMan

ID: 6 Score: -1815 Strategy: MadMan

ID: 8 Score: -1839 Strategy: MadMan

ID: 1 Score: -2208 Strategy: Saint

In generation 3 the group’s overall score was -17991 in 1000 rounds with 10 prisoners

ID: 2 Score: -1642 Strategy: Devil

ID: 5 Score: -1656 Strategy: Devil

ID: 3 Score: -1680 Strategy: Devil

ID: 1 Score: -1688 Strategy: Devil

ID: 4 Score: -1690 Strategy: Devil

ID: 10 Score: -1738 Strategy: Judge

ID: 9 Score: -1749 Strategy: Judge

ID: 6 Score: -2039 Strategy: MadMan

ID: 7 Score: -2045 Strategy: MadMan

ID: 8 Score: -2064 Strategy: MadMan

Looking at the first generation you’ll notice that the devils picked on the saints (like usual) which put the devils in the lead and sent the saints to last place. That means that the top 10% of our group was a single devil and the bottom 10% was a single saint. Because of this the next generation has four devils (up from the starting three) and only one saint (down from the starting two).

Another generation then passes with results very much like the first, causing us to lose another saint and gain another devil. Which is honestly a little ominous…

Next Time: Turning Boring Data Overflow Into Interesting Visuals

So that was just ten prisoners playing three generations of fairly short games. For a real experiment we’re going to want hundreds of prisoners playing significantly longer games over at least a dozen generations. Things like:

```prisoners = createPrisoners(250, 250, 250, 250)
playMultiGenerationalPrisonersDilemma(prisoners, 25, 10000)```

Only problem is that a big experiment like that is going to rapidly fill up your terminal with junk. Sending the results to a text file helps but even that produces a lot more numbers than the human brain can conveniently work with.

But you know what the human brain can conveniently work with? Animated bar graphs!

# Should Dark Souls 2 Have Been Royal Souls The First?

In preparation for the imminent release of Dark Souls 3 I’ve been replaying the first two games and thinking about one of the more common criticism people had about Dark Souls 2: The fact that it somehow just didn’t fully capture the excellent feel of the first game. The combat was fun, the dungeons were interesting but at the end of the day it somehow didn’t have the same impact as the original. Still a great game, definitely worth playing but somehow lacking that special something.

Many people blame this on the fact that the game had a different director than the original. And that probably played a part.

But I think the bigger issue is that Dark Souls 2 was a sequel to a story that didn’t need a sequel. Even the best of directors is going to have trouble given that sort of prompt.

You see, a big part of what made the original so fascinating was the fact that the entire game was one big cohesive mystery revolving around the questions of “Why is civilization dying?” and “What happened to the gods?” The opening cutscene makes it clear that at one points the gods had built a pretty awesome civilization so why is the world you wind up exploring such an awful place?

From that starting point every location you visited, every item you picked up, and every scrap of lore hidden in a weapon description all worked together to weave the history of the ruined world the player was fighting their way through. Do even a half-decent job of finding and piecing together these story fragments and by the time you finished the game you had a solid idea of why the Dark Souls world was the way it was.

Sure, there were dozens of minor questions left unanswered and the ending was a little open-ended but the core mysteries all had satisfying conclusions. The game felt complete all on its own.

Now enter Dark Souls 2.

The developers’ goal was to build the same sort of mystery adventure that fans of the original loved so much. The problem is, you can’t just reuse a mystery. No point in asking “What happened to the gods?” when your veteran players already know the answers.

So Dark Souls 2 needed a brand new mystery to drive the adventure.

But even with a new core mystery Dark Souls 2 was still a Dark Souls game and had to have the same general look, feel and background lore as the first game.

And I think this is what ultimately dragged down Dark Souls 2. In the original every aspect of the game was carefully designed to tell a specific story, but in the sequel the new story was forced to share the stage with countless nostalgic references to the previous game.

The end result is a mildly muddled story that lacked the cohesive punch of the original.

So let’s play “What Could Have Been” and brainstorm what the game might have looked like if it had been a standalone title and allowed to focused 100% on it’s own themes and setting. This shouldn’t be too hard. I mean, Dark Souls 2 had a ton of really cool and original content. We just need to think of a way to move it to center stage.

For starters let’s identify what the core mystery theme of Dark Souls 2 actually was.

Well… half of the Dark Soul 2 main game and all three of the DLC areas focus on exploring the ruins of ancient castles and learning about the royalty that used to live there. You learn bits about how various kings and queens grew to power as well as how their various character flaws lead to their downfall. The “Scholar of the First Sin” edition even has a mysterious NPC who shows up on a regular basis and asks you “What does it mean to be a king?”

So there’s your central mystery. The player is stuck in the middle of a country filled with the ruins of multiple generations of failed kingdoms that leave him asking: Who built all this cool stuff? What went wrong to leave it a ruin?

Since the core theme is the rise and fall of kings, so let’s call our hypothetical standalone version “Royal Souls” and move on to how we might edit the existing game to fit our new mold. Strip out the undead and the old gods and what do we have left to work with?

As a reminder, the actual plot of Dark Souls 2 begins with the character realizing they have the undead curse from the first game and finding themselves drawn to the land of Drangleic. The player then encounters a mysterious lady who points them towards a distant castle and suggests that going there and talking with a certain king might help with the curse. But to get to the castle they need to gather four ancient souls (all with possible connections to the first game).

In our theoretical Royal Souls we could instead begin with the character (who isn’t a cursed undead) still finding themselves irresistibly drawn to the land of Drangleic. The player could then encounter the same mysterious lady who points them towards the same castle and tells them that the reason they have been drawn here is because they are destined to meet the King.

But wait! Without the undead curse how do we make the game work? Reviving when you die is a core part of the experience. And what about the bonfires? What do we use for check points if we don’t have the First Flame and bonfires from the Dark Souls series?

Well… what if we replaced the bonfires with ruined thrones that player can sit on? And when the player dies he returns to the last throne he sat upon?

You see, in Royal Souls the main driver of the plot wouldn’t be souls and humanity and curses and gods but instead the fact that the Royal Soul’s version of Drangleic is a mystic land that desperately needs a new king and naturally attracts people with the spark of royalty. The land itself then keeps them alive until they either go mad from their many deaths or finally achieve the goal of ascending to kinghood.

The four ancient souls the player needs to collect before opening the path to Drangleic Castle? They now become four royal souls, each belonging to a different king who at one time ruled Drangleic before falling into ruin and/or madness (which shouldn’t be a hard change since two of them fit that description anyways).

The player then eventually makes it to Drangleic Castle and discovers that the current king is mad or dying or cursed or maybe missing entirely. There’s some sort of final dramatic boss fight and the game ends with the player, having proven their worth, becoming the new king of Drangleic. The truth is finally revealed: The King they were questing to meet with was themselves all along.

And yet… after spending the entire game learning about the failures of a half dozen previous kings, can the player really say with any confidence that their reign will last? Maybe there is no such thing as a True Royal Soul.

So that basic plot sounds good enough. Gives the player a reason to explore a bunch of dungeons and has a nice but not too crazy twist ending. All that’s left to do now is flesh the world out with details about the various failed kingdoms. And since we’ve dropped all the Dark Souls references we have more than enough room to do so. Instead of “wasting” half of our equipment and most of our spells on references to Dark Souls we can make sure that every item description relates directly to one of the half-dozen kings of Drangleic.

For example, instead of pyromancy spells that constantly reference the old lore of Dark Souls we could have similar but new “Iron Works”, a unique brand of metal and fire themed magic invented during the reign Old Iron King. The player could then learn more about the Old Iron King by collecting Iron Works in the same way that Dark Souls 1 players learned more about the Witch of Izalith by learning pyromancies.

At this point you probably either think I’m crazy or are already half-way through your own redesign of the lore and setting of Dark Souls 2.

Either way it will certainly be interesting to see what happens with Dark Souls 3. They’ve brought back the original director and his recent work on Bloodborne shows he still knows how to tell an amazing standalone story. But can he pull off a sequel? Can he find a way to blend the lore he wrote in the original with the lore he wants to create for this third game?

I certainly hope so.

# Let’s Program A Prisoner’s Dilemma Part 6: Eye For An Eye

It’s finally time to write a prisoner with some actual brain power. Let’s start by looking at our current prisoners and their unique issues:

Saints always cooperate, making them an easy target for defectors.

Devils always defect, which leads to bad scores for everyone when multiple devils get together.

Madmen act randomly, which means whether or not they make good choices is up to chance.

What we really want is a prisoner that cooperates when cooperating is a good idea and defects in self defense when it suspects its about to be betrayed. A prisoner that can judge whether or not its partner deserves to be trusted.

Trust No One?

But how will our new “judge” type prisoner decide who to trust? The only thing it will know about its partner is their ID. There’s no way to force the other prisoner to reveal their strategy*, or at least there shouldn’t be. After all, the prisoner’s dilemma is meant to model real life and most real humans aren’t mind readers.

So how will our judge decide how to make decisions if he can’t read minds or see the future? The same way we humans do. We trust people who act trustworthy and we are suspicious of people who betray us.

This leads to a strategy called “tit-for-tat”, where you treat your partner the same way they treat you. If they betray you then the next time you meet them you betray them. If they cooperate then the next time you see them you pay them back by cooperating.

To pull this off we’re going to have to give our judges a memory.

Remember that reportResults function that we programed into the original prisoner class? We’ve been ignoring that so far because none of our prisoners needed it. Saints, devils and madmen always act the same way so they don’t really care how their partners act.

But our judge can use the info from reportResults to build a list of people he can and can’t trust. All we have to do is initialize a blank hash when the judge is created. Then every time reportResults is called we update that hash. We then use this hash in cooperate? by taking the provided partner ID, looking up in our hash whether or not they like to cooperate and then matching their behavior.

But wait! What do we do the first time we meet a new player? We can’t copy their behavior if we’ve never seen how they behave!

The answer is to remember the Golden Rule and “Treat others like you want to be treated”. That means the first time a judge meets a new player he will cooperate. Not only is this good manners, it helps make sure that when judges meet each other they will get locked into a loop of infinite cooperation instead of a loop of infinite betrayal.

Designing The Judicial Branch

The two things that make a judge a judge are:

1) It keeps track of how other prisoners treat it

2) If it meets a prisoner more than once it copies their last behavior

So let’s start with feature 1 by giving our prisoner a memory. To do that we’re going to have to create a hash during prisoner initialization and then use the learnResults function to fill it with useful data.

```def initialize(id)
super(id)
@strategy = "Judge"
@opponentBehavior = Hash.new()
end

def learnResults(opponentID, opponentCooperated)
@opponentBehavior[opponentID] = opponentCooperated
end```

Now that our opponentBehavior hash is filling up all that’s left is to use it as part of our decision making process. This is a pretty simple two step process. When our judge is asked whether or not it wants to cooperate with a given prisoner it starts by checking whether or not it has an opponentBehvaior entry for that ID. If it does it just mimics back whatever behavior it recorded for that ID, but if it’s empty it instead defaults to cooperation.

```def cooperate?(opponentID)
if( @opponentBehavior.key?(opponentID))
return @opponentBehavior[opponentID]
else
return true
end
end```

Put it all together and what do you get?

```class Judge < Prisoner

def initialize(id)
super(id)
@strategy = "Judge"
@opponentBehavior = Hash.new()
end

def cooperate?(opponentID)
if( @opponentBehavior.key?(opponentID))
return @opponentBehavior[opponentID]
else
return true
end
end

def learnResults(opponentID, opponentCooperated)
@opponentBehavior[opponentID] = opponentCooperated
end
end```

Featuring Four Different Character Classes!

Now let’s give our code a test by setting up a group with four judges, four saints, four devils and four madmen.

The Group’s Overall Score was -23546 in 1000 rounds with 16 prisoners

ID: 8 Score: -1126 Strategy: Devil

ID: 7 Score: -1170 Strategy: Devil

ID: 6 Score: -1198 Strategy: Devil

ID: 5 Score: -1254 Strategy: Devil

ID: 14 Score: -1391 Strategy: Judge

ID: 16 Score: -1394 Strategy: Judge

ID: 15 Score: -1398 Strategy: Judge

ID: 13 Score: -1425 Strategy: Judge

ID: 12 Score: -1479 Strategy: MadMan

ID: 9 Score: -1483 Strategy: MadMan

ID: 11 Score: -1498 Strategy: MadMan

ID: 10 Score: -1510 Strategy: MadMan

ID: 3 Score: -1766 Strategy: Saint

ID: 2 Score: -1790 Strategy: Saint

ID: 4 Score: -1802 Strategy: Saint

ID: 1 Score: -1862 Strategy: Saint

In our mixed group you can see that the judges outperform both the madmen and the saints and come pretty close to matching the devils.

But that’s not good enough. We didn’t want to just match the devils, we wanted to beat them! It’s absolutely infuriating that our genuinely intelligent judges are somehow being outscored by a bunch of dumb always-defectors.

Grudge Match

OK, time to get to the bottom of this. Why can’t our judges beat the devils? Let’s get rid of all the saints and madmen and isolate our problem.

The Group’s Overall Score was -17859 in 1000 rounds with 10 prisoners

ID: 10 Score: -1558 Strategy: Judge

ID: 7 Score: -1581 Strategy: Judge

ID: 6 Score: -1581 Strategy: Judge

ID: 9 Score: -1592 Strategy: Judge

ID: 8 Score: -1597 Strategy: Judge

ID: 2 Score: -1990 Strategy: Devil

ID: 3 Score: -1990 Strategy: Devil

ID: 4 Score: -1990 Strategy: Devil

ID: 5 Score: -1990 Strategy: Devil

ID: 1 Score: -1990 Strategy: Devil

Well would you look at that. When all you have are devils and judges the judges scream ahead into first place no problem.

It’s not that our judges weren’t smart enough to out-think the devils in the mixed game, it’s that the devils had a bunch of saints sitting around they could exploit for easy points. As soon as we took away the ever-forgiving all cooperators the devils sank like a rock while the judges pulled off a brilliant group victory by cooperating with each other and paying back the deceitful devils with defection after defection.

Impossible To Trust

Let’s finish up with a few more what-if scenarios, like “What if you stuck a bunch of judges with a bunch of saints?”

The Group’s Overall Score was -10000 in 1000 rounds with 10 prisoners

ID: 1 Score: -1000 Strategy: Saint

ID: 2 Score: -1000 Strategy: Saint

ID: 3 Score: -1000 Strategy: Saint

ID: 4 Score: -1000 Strategy: Saint

ID: 5 Score: -1000 Strategy: Saint

ID: 6 Score: -1000 Strategy: Judge

ID: 7 Score: -1000 Strategy: Judge

ID: 8 Score: -1000 Strategy: Judge

ID: 9 Score: -1000 Strategy: Judge

ID: 10 Score: -1000 Strategy: Judge

A ten way tie with a perfect group score, just like when we had a group of pure saints. As long as you’re nice to the judges they’ll be perfectly nice to you.

What if we get rid of the saints and just have judges?

The Group’s Overall Score was -10000 in 1000 rounds with 10 prisoners

ID: 1 Score: -1000 Strategy: Judge

ID: 2 Score: -1000 Strategy: Judge

ID: 3 Score: -1000 Strategy: Judge

ID: 4 Score: -1000 Strategy: Judge

ID: 5 Score: -1000 Strategy: Judge

ID: 6 Score: -1000 Strategy: Judge

ID: 7 Score: -1000 Strategy: Judge

ID: 8 Score: -1000 Strategy: Judge

ID: 9 Score: -1000 Strategy: Judge

ID: 10 Score: -1000 Strategy: Judge

Yet another perfect score! Since judges start off by cooperating they inevitably end up trusting each other and create just as nice a world as a group of pure saints would.

That’s enough happy thoughts for now. Why not try something more sinister? Like a group full of devils with only one judge?

The Group’s Overall Score was -19991 in 1000 rounds with 10 prisoners

ID: 1 Score: -1998 Strategy: Devil

ID: 2 Score: -1998 Strategy: Devil

ID: 3 Score: -1998 Strategy: Devil

ID: 4 Score: -1998 Strategy: Devil

ID: 5 Score: -1998 Strategy: Devil

ID: 9 Score: -1998 Strategy: Devil

ID: 7 Score: -1998 Strategy: Devil

ID: 8 Score: -1998 Strategy: Devil

ID: 6 Score: -1998 Strategy: Devil

ID: 10 Score: -2009 Strategy: Judge

As we’ve seen time and time again there is literally no way to win in a world full of devils. They will always betray you and so you can never get ahead.

But unlike the saint, which was absolutely destroyed by a gang of devils, the judge manages to at least keep his loses pretty low. As you can see from the numbers the judge cooperated exactly once with every single devil and then never trusted them again, thereby preventing them from leeching more points out of him.

* There is actually a variation of the prisoner dilemma where each prisoner is given a complete copy of their partner’s code as an input. We’re not doing that.