Strategy API (safe subset)
Your function is called every round with an
api
object. Return 'C'
or 'D'
.
function move(api){ // Read-only helpers api.round // 1-based round index api.history // [{me:'C'|'D', opp:'C'|'D', pa:number, pb:number}, ...] api.last() // last round object or null api.oppLast() // 'C'|'D' or null api.meScore() // my cumulative payoff so far api.oppScore() // opponent cumulative payoff api.rand() // deterministic RNG in [0,1) // Return 'C' or 'D' return 'C' }Security note: code runs in a tight sandboxed Function; no DOM/window access. Timeouts are guarded.
Prisoner’s Dilemma Payoff Matrix [You, Opp]
C,C → 3,3
C,D → 0,5
D,C → 5,0
D,D → 1,1
Equilibrium: D,D. Long‑run cooperation can dominate vs reciprocators.
Coach
Write your rule, then hit “Run Tournament”.
Tournament Table
Average payoff per round (higher is better). Green = beats opponent; red = loses.