From c135d7aa10180c2ddacfd4208baa135e99b6ba8b Mon Sep 17 00:00:00 2001
From: Liyao Zhu <stevens.zhu@gmail.com>
Date: Fri, 5 Apr 2019 17:21:38 +1100
Subject: [PATCH] game build1
---
game.py | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/game.py b/game.py
index 2ec4890..77cc3c5 100644
--- a/game.py
+++ b/game.py
@@ -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
--
GitLab