diff --git a/agent.py b/agent.py index 7139671f54ecf19d7d19dfabfe574dc3fa2eb4c9..211e3c81ac8afc11c3b1ab79e2b51aa4102f2685 100644 --- a/agent.py +++ b/agent.py @@ -5,7 +5,7 @@ import game class Agent(): - def __init__(self): + def __init__(self, R, M, initialwealth): 'add variables to construct agent instance and define instance variables' diff --git a/game.py b/game.py index 77cc3c596fd835d0e27acad5a28a36b048a6477c..9c0465287d7f9ab7c4e03b1466e466a6ad30972f 100644 --- a/game.py +++ b/game.py @@ -19,6 +19,18 @@ class game(): self.threshold = 0 # Threshold + def createPalyers(self): + players = [] + IW = 100 # Initial Wealth +# for i in range(self.N): +# players.append(agent.Agent(self.R, self.N, IW)) +# +#(strategy, wealth, fitness) + + + def updatePopulation(self): + pass + def lossfrac(self, alpha): """the percentage of wealth that players are going to lose if collective-risk happens""" @@ -36,3 +48,19 @@ class game(): elif RF == 2: return 1 return 0 + + + + def computePayoff(self): + pass + + + def selectPlayers(self): + """ + Randomly select M players from population of size N. + """ + return np.random.choice(self.N, self.M) + + + def play(self): + pass \ No newline at end of file