Skip to content

Instantly share code, notes, and snippets.

@rvcx
Created June 24, 2017 14:38
Show Gist options
  • Save rvcx/c6d1dd78ebe2e0ac88fe9471b01a1a5f to your computer and use it in GitHub Desktop.
Save rvcx/c6d1dd78ebe2e0ac88fe9471b01a1a5f to your computer and use it in GitHub Desktop.
def simulate(strategies, turns):
pot = 1.0
players = [ [s, 0] for s in strategies ]
for i in range(turns):
p = random.choice(players)
if p[0] > pot:
pot = 1.0
else:
p[1] += p[0]
pot -= p[0]
return players
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment