GAME THEORY
Rational agents, irrational outcomes
Tit-for-tat cooperates first, then copies the other player's last move. Mutual cooperation pays 3 a round each. Two tit-for-tat players play 200 rounds. Each move is flipped by accident 5% of the time. What happens to their average payoff?
In the prisoner’s dilemma two players choose to cooperate (C) or defect (D). Mutual cooperation pays 3 each, mutual defection 1 each, and a lone defector gets 5 while the sucker gets 0. Played once, defecting is better whatever the other does, so rational players both get 1.
Played repeatedly, a defection can be punished later. That needs a future. With a fixed, known last round, backward induction unravels it: defect in the last round, so also in the one before, and so on back to the first. Cooperation holds up in theory when there is no known last round or the future is discounted. The strategies here are simple rules that never count down to round 200. Tit-for-tat cooperates first, then copies the other player’s last move. That works until a move is flipped by noise.
Prisoner's dilemma (row, column):
C D
C 3, 3 0, 5
D 5, 0 1, 1
One shot: D beats C whatever the other does (5 > 3, 1 > 0).
(D, D) is the only Nash equilibrium; (C, C) pays both more.
Repeated, 200 rounds:
tit-for-tat: play C first, then copy their last move
generous TFT: like TFT, but after their D play C with prob 1/3
noise: each move is flipped with probability NOISE
TFT vs TFT after one flipped move:
C C D C D C D … (A)
C C C D C D C … (B) retaliation echoes until another flip
Generous TFT breaks the echo after ~3 rounds on average. The strip checks that cooperation holds: the average payoff stays at or above 2.5 per round. ONE-SHOT fails at once. TFT + NOISE fails under 5% noise. FIX: GENEROUS TFT faces the same flipped moves and ends at 2.83. Lower-case letters in the history are the flips.
Plain tit-for-tat collapses at 5% noise. Drag NOISE down and find how much noise it can tolerate while still averaging 2.5 per round over 200 rounds. Read the line under the sim at each setting.
GOAL: tit-for-tat vs tit-for-tat averages ≥ 2.5 per round
Write strategy(history, rnd), returning 'C' or 'D'. history holds the moves that actually happened, oldest first. rnd() is a seeded random number in [0, 1): use it instead of Math.random so every grading run plays the same games. The grader plays 200 rounds with 5% noise against a copy of you, tit-for-tat and generous TFT (you need ≥ 2.5 per round against each), and against always-defect (you need ≥ 0.6, so you cannot be a pushover).
Congestion control (fair TCP versus aggressive senders), BitTorrent's tit-for-tat choking, peer-to-peer free-riding, blockchain mining incentives, and price wars. Mechanism design is the practice of changing the payoffs so the selfish choice is the good one.
“What is a Nash equilibrium, and why is the prisoner's dilemma one bad?” or “design a strategy for the repeated game.” Show that defect dominates, explain how repetition supports cooperation, and say that with noise you need forgiveness, such as generous TFT or tit-for-two-tats, and that too much of it gets exploited.