Lesson 2 of 7 · 2 min
The idea of regret
After each decision, ask how much better each other choice would have done. Keep a running total, and next time choose actions in proportion to their positive regret. The average strategy over many games approaches an equilibrium.
import numpy as np
def strategy(regret):
positive = np.maximum(regret, 0)
total = positive.sum()
return positive / total if total > 0 else np.ones(len(regret)) / len(regret)
print(strategy(np.array([3.0, 1.0])))
print(strategy(np.array([-2.0, -5.0])))
