From d36fb4748c82227428d78ec01aed60ec2dbc31f5 Mon Sep 17 00:00:00 2001
From: Liyao Zhu <stevens.zhu@gmail.com>
Date: Fri, 5 Apr 2019 17:59:55 +1100
Subject: [PATCH] game build2

---
 agent.py |  2 +-
 game.py  | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/agent.py b/agent.py
index 7139671..211e3c8 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 77cc3c5..9c04652 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
-- 
GitLab