Robert Axelrod is a political scientist at the University of Michigan. In 1980 he invited game theorists to send in computer programs for the repeated Prisoner's Dilemma and ran them in a round robin: 14 entries, every pair playing 200 rounds. Anatol Rapoport, a mathematical psychologist at the University of Toronto, sent the shortest program of all, four lines of Tit for Tat, and won. Axelrod published everything and ran a second tournament with 62 entries from six countries, this time with the end of each match decided by chance so that nobody could count down to the last round. Rapoport was the only person to enter Tit for Tat again, and it won again. The biologist John Maynard Smith entered Tit for Two Tats in that second tournament; Axelrod worked out that it would have won the first, but against a crowd of strategies built to exploit forgiveness it finished 24th. Axelrod's 1984 book, The Evolution of Cooperation, came out of those two tournaments.
Playing again and again
In Chapter 2 the Cookie Game had a sad answer: grab, and watch two players get 1 cookie each when they could have had 3. That was for a game played once. Play the same opponent twenty times in a row and a grab today can be answered tomorrow. This chapter is about the strategy that won the most famous computer tournament in game theory, why it wins, and the one situation where the whole idea falls apart.
Here is the Cookie Game from Chapter 2 again, the one grown-ups call the Prisoner's Dilemma. Two players each secretly choose Share or Grab. Both share: 3 cookies each. One grabs while the other shares: the grabber gets 5, the sharer gets 0. Both grab: 1 each. Grab is the dominant strategy, because whatever the other player does, grabbing gets you 2 more cookies. So both players grab, both get 1, and both stare at the 3 they could have had. Both grabbing is the only Nash equilibrium, and it is a bad one.
Now change one thing. You play the same opponent twenty times in a row, and you both remember every round. Game theorists call this a repeated game, and the memory changes everything. A grab in round 4 is not free anymore, because the other player can answer it in round 5, and 6, and 7. What might happen later changes what is smart now. There is a lovely name for this: the shadow of the future.
Robo cannot play "perfectly" here, because there is no single best way to play a repeated Cookie Game: how good a move is depends on who you are playing. So Robo follows a strategy, a fixed rule that decides every move, and you pick which one. Play a few. Then choose Mystery Robo, which picks a strategy in secret, and work out which one it is from the way it answers you. A well-placed grab tells you a lot.
Twenty rounds of the Cookie Game
Share or Grab each round. Both share: 3 and 3. A grab on a share: 5 and 0. Both grab: 1 and 1.Which strategy was Robo using? One guess.
The four-line strategy
Tit for Tat is this: share in round 1, and after that do whatever the other player did in the round before. That is the whole strategy. In 1980 a political scientist named Robert Axelrod ran a computer tournament in which strategies played the repeated Cookie Game against each other. Tit for Tat, the shortest program anyone sent in, won. Axelrod published the results, ran a second and bigger tournament, and it won again.
He looked at what the strategies near the top had in common and found four things.
- Nice. Never grab first. In the first tournament the top eight strategies were all nice, and none of the others were.
- Retaliating (say: ri-TAL-ee-ay-ting). If the other player grabs, grab right back. Always Share never punishes, and gets eaten.
- Forgiving. When they go back to sharing, go back to sharing. Grudger never forgives, and loses the rest of the game over one bad round.
- Clear. Be easy to figure out. If the other player can work out your rule in a few rounds, they can also work out that sharing with you is their best plan.
Tit for Tat has all four, and one strange property besides: you can never beat it by much. Here is the proof.
- Only two kinds of round change the gap between your score and Robo's: you grab while Robo shares (you go up 5), or Robo grabs while you share (Robo goes up 5). A round where you both do the same thing changes nothing.
- Tit for Tat grabs only because you grabbed in the round before. So Robo grabs exactly as many times as you do, except that a grab of yours in the last round is never answered.
- Now count. Your grabs are the rounds where you grabbed on a share (call that number a) plus the rounds where you both grabbed. Robo's grabs are the rounds where it grabbed on your share (call that b) plus those same both-grabbed rounds. So your grabs minus Robo's grabs is a minus b, and step 2 says that is 0 or 1.
- Your lead is 5 × (a minus b): either 0 or 5. One grab's worth at most, and only by grabbing in the last round.
So Tit for Tat never beats anybody: head to head, it ties or loses by 5. It wins tournaments because a tournament is not scored by who beats whom. It is scored by your total. Tit for Tat collects 3 a round from every opponent willing to share, is never a sucker for more than one round, and goes straight back to 3 a round when the other player does. The strategies that "beat" it by 5 spend the rest of the tournament collecting 1s from each other. That is the lesson of this chapter: do not try to beat the other player. Try to score well.
The tournament
Here is your own version of Axelrod's tournament. Every strategy you tick plays every other one, and a copy of itself, for a set number of rounds. Highest total wins. The default is 200 rounds because that is what Axelrod used in his first tournament, and Random is in the field because he put one in his.
Look closely at the result. In this field Grudger usually finishes a little ahead of Tit for Tat, and the whole gap comes from Random: after Random's first grab, Grudger grabs forever and collects 5 or 1 from every coin flip, 3 a round on average, while Tit for Tat, copying a coin, gets only 2.25. Untick Random and the two tie exactly, because against everyone else here they make identical moves. Who wins depends on who is in the field. Axelrod's was full of clever programs trying to take advantage of each other, and in that crowd Tit for Tat came out on top.
Then there is the noise slider. In real life hands slip and signals get misread: you meant to share and the other player saw a grab. Noise gives every move a small chance of being flipped by mistake. Set it to 5% and watch the "vs itself" column. Tit for Tat playing its own copy drops from 3 a round to about 2.3: one mistaken grab gets answered, the answer gets answered, and the two copies take turns punishing each other for a mistake nobody meant. Tit for Two Tats ignores a single mistake and stays near 2.95. Pavlov wobbles for two rounds, finds its way back to sharing, and stays near 2.8. Untick Random, set the noise to 2 or 3 percent, and run it several times: Pavlov and Tit for Two Tats each finish above Tit for Tat about three runs out of four. Push the noise to 10% and Grudger and Always Grab climb to the top instead: when mistakes are everywhere, most matches collapse into mutual grabbing sooner or later, and the strategies that were grabbing anyway lose the least.
You can also build a strategy of your own: its first move, what it does after the other player shared, and what it does after they grabbed. That covers every strategy that remembers exactly one round back, 2 × 2 × 2 = 8 of them, and some are ones you already know. Change any of the three choices and your creation enters as Yours.
Round robin
Every strategy plays every other one, and itself. Highest total wins.Build your own
"vs itself" is the average cookies per round a strategy collects from a copy of itself (3.00 means they shared every round). "vs Tit for Tat" is a separate head-to-head match with the same settings: that strategy's score, then Tit for Tat's.
The last round problem
Now a puzzle that has bothered game theorists for a long time. Suppose both players know for certain that the game ends after round 20. Think backwards, the way you did in Chapter 5. In round 20 there is no tomorrow, nothing to punish and nothing to reward: Grab is dominant, so both players grab. But then round 19 has no future either, because round 20 is already settled as a grab whatever you do. So grab in 19. And in 18. It unravels all the way back to round 1. With an ending everybody knows about, backward induction says grab every round, and the shadow of the future is gone.
Real people do not do this. In experiments, people who play a fixed number of rounds mostly share, and start grabbing near the end if at all. The unraveling needs both players to be certain about the ending, and certain that the other is certain, and so on (Chapter 18 is about that). The fix game theorists use is simpler: make the ending uncertain. After every round, roll for whether there is another one: the game continues with probability p and ends with probability 1 - p. Now no round is ever known to be the last, and the shadow of the future never goes away.
How many rounds should you expect? Round 1 always happens. Round 2 happens with probability p. Round 3 needs two "continue" rolls in a row: p × p = p². Round 4 needs three: p³. Add up the chance of each round happening and you get the expected number of rounds, the average over many games. With p = 0.9:
| Round | Chance it happens | Running total |
|---|---|---|
| 1 | 1 | 1 |
| 2 | 0.9 | 1.9 |
| 3 | 0.81 | 2.71 |
| 4 | 0.729 | 3.439 |
| 5 | 0.6561 | 4.0951 |
| 10 | 0.387 | 6.513 |
| 20 | 0.135 | 8.784 |
| 50 | 0.0057 | 9.948 |
The terms never stop, but the running total never passes 10. In general:
Why: call the whole sum T. Multiply every term by p and you get p + p² + p³ + ..., which is T with the first 1 missing. So pT = T - 1, and T = 1 / (1 - p). With p = 0.9 that is 1 / 0.1 = 10 rounds on average: sometimes the game ends after round 1, sometimes it runs past 30.
When does a grab stop paying? Play Grudger and share forever: you expect 3 a round, 3/(1 - p) cookies in all. Or grab once, get 5, and then it is grabbing for both of you forever, 1 a round from round 2 on. The rounds after the first add up to p + p² + ... = p/(1 - p), so that plan is worth 5 + p/(1 - p). Sharing is better when
Multiply both sides by (1 - p), which is positive, so the inequality keeps its direction:
If the game continues with better than a 50% chance each round, the grab does not pay. That is the shadow of the future as a number. (Against Tit for Tat there is a sneakier plan: grab once, take the one punishment, then go back to sharing: 5, 0, 3, 3, 3, ... Work through the same steps and sharing wins only when p > 2/3. A forgiving opponent needs a longer shadow to keep you honest.)
Played once, the Cookie Game is won by grabbing, and everybody loses. Played again and again with no known last round, a grab can be punished, so sharing can be the smart move. Be nice, hit back, forgive, and be easy to read. Tit for Tat never beats anyone, and it wins anyway, because the game is about your total, not about beating the person across the table.
1. Tit for Tat plays Always Grab for 10 rounds. What does each one score?
Answer
Round 1: Tit for Tat shares, Always Grab grabs, so 0 and 5. Rounds 2 to 10: both grab, 1 each. Tit for Tat: 0 + 9 × 1 = 9. Always Grab: 5 + 9 = 14. Always Grab wins by 5, one grab's worth.
2. Tit for Tat plays a copy of itself for 10 rounds. What does each one score?
Answer
Both share every round: 30 each. Tit for Tat "lost" to Always Grab in problem 1 and still came away with far more cookies here.
3. The game continues after each round with probability p = 0.8. How many rounds should you expect?
Answer
1 / (1 - 0.8) = 1 / 0.2 = 5 rounds on average.
With noise at 0, find a strategy, built in or built by you, that beats Tit for Tat head to head over 200 rounds (the "vs Tit for Tat" column shows you). Then explain why your winner still loses the tournament.
Answer
Always Grab does it: 5 + 199 × 1 = 204 against Tit for Tat's 0 + 199 = 199. So does any strategy that grabs in round 200, and by the proof above the margin is always exactly 5. But look at the totals. Always Grab collects 1 a round from every strategy that hits back, 200 from its own copy. Tit for Tat collects 3 a round from every nice strategy, 600 from its own copy, and is never more than 5 behind anyone. Winning one match by 5 and giving away hundreds of cookies everywhere else is a bad trade.
Stars in this chapter
Earn them by doing the clever thing, not by clicking around.
- Score 60 in 20 rounds against Tit for Tat
- Work out which strategy Mystery Robo is using
- Run a tournament with 5 or more strategies and 5% noise or more