Cooperator
Always cooperates. The nicest possible neighbour, and the easiest to exploit.
name: Cooperator else -> C "friends?"
Every strategy is written in the same little language. Copy one of these into the season page and edit it to make your own.
Always cooperates. The nicest possible neighbour, and the easiest to exploit.
name: Cooperator else -> C "friends?"
Always defects. Beats every match on points, and loses every tournament.
name: Defector else -> D "ha!"
Cooperates first, then copies the opponent's last move. Winner of both of Axelrod's tournaments.
name: Tit for Tat if opp.last == D -> D "tat!" else -> C
Tit for Tat, but opens with a defection. Locks into mutual retaliation against Tit for Tat.
name: Suspicious Tit for Tat open: D if opp.last == D -> D "tat!" else -> C
Only retaliates after two defections in a row. Forgiving, and safe against noise.
name: Tit for Two Tats if opp.last(2) all D -> D "enough!" else -> C
Punishes each defection with two defections.
name: Two Tits for Tat if opp.last(2) any D -> D "double tat!" else -> C
Cooperates until the opponent defects once, then defects forever.
name: Grudger if opp.defections >= 1 -> D "never forget" else -> C
Win-Stay, Lose-Shift: repeats its move after a good payoff (3 or 5), switches after a bad one.
name: Pavlov open: C if payoff >= 3 -> repeat "win-stay" else -> switch "lose-shift"
Flips a coin every round.
name: Random if chance 50% -> C "heads" else -> D "tails"
Tit for Tat that forgives a defection 10% of the time, which breaks retaliation loops.
name: Generous Tit for Tat if opp.last == D and chance 10% -> C "forgiven" if opp.last == D -> D "tat!" else -> C
After the opponent's nth defection, punishes with n defections, then cooperates twice no matter what. Matches the Axelrod library's Gradual.
name: Gradual open: C if mem.punish > 0 -> D "still mad" do mem.punish -= 1 if mem.calm > 0 -> C "cooling off" do mem.calm -= 1 if opp.last == D -> D "GRUDGE!" do mem.punish = opp.defections - 1, mem.calm = 2 else -> C
Cooperates and defects in turn, ignoring the opponent.
name: Alternator open: C else -> switch "flip"
Probes with C, D, C, C. If the opponent never retaliated in those four rounds, exploits them forever; otherwise plays Tit for Tat.
name: Detective open: C D C C if mem.exploit == 1 -> D "sucker" if round == 5 and opp.defections == 0 -> D "sucker" do mem.exploit = 1 else -> copy "tit for tat"
Cooperates as long as the opponent has cooperated at least as often as defected.
name: Soft Majority if opp.cooperations >= opp.defections -> C "mostly nice" else -> D "mostly nasty"