Four lines of code that won a tournament and reframed how we think about cooperation: tit-for-tat cooperates on the first move, then copies whatever the opponent did last. In Axelrod’s iterated prisoner’s dilemma tournaments it beat every cleverer strategy. Its virtues: nice (never defects first), retaliating (punishes at once), forgiving (returns to cooperation), and clear (easy to read). It never wins a single match — it just never loses badly.
The demo scores tit-for-tat over 10 rounds against always-defect and always-cooperate: live demo
“Tit-for-tat wins by beating opponents.” — it never scores more than its opponent in any single match; it wins tournaments by never being exploited and inviting mutual cooperation. cited
It never wins a game, and wins the tournament. strategy
On i-13, over 10 rounds tit-for-tat scores 9 vs always-defect (suckered once) and 30 vs always-cooperate: