-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathagent.py
61 lines (41 loc) · 1.23 KB
/
agent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Class Agent
import numpy as np
class Agent (object):
def __init__ (self, ID):
self.ID = ID
self.bank = 0
self.strat = 0
self.passort = 0
self.switchprob = 0
self.coop = np.random.normal(.5, .15)
while self.coop <= 0 or self.coop >= 1:
self.coop = np.random.normal(.6, .12)
self.bayes = np.random.normal(.5, .15)
while self.bayes <= 0 or self.bayes >= 1:
self.bayes = np.random.normal(.5, .15)
def get_id (self):
return self.ID
def set_strat (self, strat):
self.strat = strat
def get_strat (self):
return self.strat
def set_assort (self, assort):
self.passort = assort
def get_assort (self):
return self.passort
def set_bank (self, bank):
self.bank = bank
def get_bank (self):
return self.bank
def set_sp (self, switchprob):
self.switchprob = switchprob
def get_sp (self):
return self.switchprob
def get_coop (self):
return self.coop
def set_coop (self, coop):
self.coop = coop
def get_bayes (self):
return self.bayes
def set_bayes (self, bayes):
self.bayes = bayes