Python Code to rum simulations of Prisoner's Dilemma for different payoffs and calculate expected payoffs
Recommended number of simulations: 5000-8000
Approximate runtime for 5000 simulations: 1.89 seconds
Prisoner's Dilemma is a game theory problem where two individuals have to make independent choice however the payoff for every individual is dependent on their collective choices
Their are two options, snitch
or stay loyal
The expcted value of payoff is difficult to calcute however it converges according to Law of Large Numbers
This code simulates the choices for both prisoners and outputs resultant expected payouts for the strategies
It plots the expected value after every simulation to visualize the convergence
About the Problem: https://en.wikipedia.org/wiki/Prisoner%27s_dilemma