Skip to content
Snippets Groups Projects
Commit c135d7aa authored by Liyao Zhu's avatar Liyao Zhu
Browse files

game build1

parent b7fa7bb1
Branches
Tags
No related merge requests found
......@@ -9,4 +9,30 @@ import utilis
class game():
def __init__(self):
datamap = utilis.read()
self.N = datamap['N']
\ No newline at end of file
self.N = datamap['N'] # N-Player Game
self.M = datamap['M'] # Randomly choose M players to play the game (normally 2)
self.RF = datamap['RF'] # Parsed number of risk function chosen for the game
self.alpha = datamap['alpha'] # Loss fraction
self.R = datamap['R'] # Rounds of a game
self.threshold = 0 # Threshold
def lossfrac(self, alpha):
"""the percentage of wealth that players are going to lose if collective-risk happens"""
for risk in range(0,1):
return risk
def riskfunc(self,RF,contribution,anything):
"""the probability of collective-risk happening, given contribution"""
if RF == 1:
return # probably parse more parameters here
elif RF == 2:
return 1
return 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment