@@ -25,8 +25,9 @@ def __init__(self, initial='C'):
25
25
('D' , 'C' ): 'D' ,
26
26
('D' , 'D' ): 'C' ,
27
27
}
28
- self ._initial = initial
29
28
self .classifier ['stochastic' ] = False
29
+ self ._initial = initial
30
+ self .init_args = (initial ,)
30
31
31
32
def strategy (self , opponent ):
32
33
"""Switches if it doesn't get the best payout, traditionally equivalent
@@ -58,6 +59,7 @@ def __init__(self, four_vector, initial='C'):
58
59
self ._four_vector = dict (zip ([('C' , 'C' ), ('C' , 'D' ), ('D' , 'C' ), ('D' , 'D' )], map (float , four_vector )))
59
60
self ._initial = initial
60
61
self .classifier ['stochastic' ] = any (0 < x < 1 for x in set (four_vector ))
62
+ self .init_args = (four_vector , initial )
61
63
62
64
def strategy (self , opponent ):
63
65
if not len (opponent .history ):
@@ -83,6 +85,7 @@ def __init__(self, p=None):
83
85
self .p = p
84
86
four_vector = [1 , p , 1 , p ]
85
87
super (self .__class__ , self ).__init__ (four_vector )
88
+ self .init_args = (p ,)
86
89
87
90
def __repr__ (self ):
88
91
return "%s: %s" % (self .name , round (self .p , 2 ))
@@ -107,6 +110,7 @@ def __init__(self, ep=0.05):
107
110
self .ep = ep
108
111
four_vector = (1. - ep , ep , ep , 1. - ep )
109
112
super (self .__class__ , self ).__init__ (four_vector )
113
+ self .init_args = (ep ,)
110
114
111
115
112
116
class ZeroDeterminantPlayer (MemoryOnePlayer ):
@@ -137,16 +141,18 @@ def __init__(self, phi=0., s=None, l=None):
137
141
138
142
four_vector = [p1 , p2 , p3 , p4 ]
139
143
MemoryOnePlayer .__init__ (self , four_vector )
144
+ self .init_args = (phi , s , l )
140
145
141
146
142
147
class ZDGTFT2 (ZeroDeterminantPlayer ):
143
148
"""A Generous Zero Determinant Strategy."""
144
149
145
150
name = 'ZD-GTFT-2'
146
151
147
- def __init__ (self , phi = 0. , chi = 2. ):
152
+ def __init__ (self ):
148
153
(R , P , S , T ) = Game ().RPST ()
149
154
ZeroDeterminantPlayer .__init__ (self , phi = 0.25 , s = 0.5 , l = R )
155
+ self .init_args = ()
150
156
151
157
152
158
class ZDExtort2 (ZeroDeterminantPlayer ):
@@ -157,6 +163,7 @@ class ZDExtort2(ZeroDeterminantPlayer):
157
163
def __init__ (self ):
158
164
(R , P , S , T ) = Game ().RPST ()
159
165
ZeroDeterminantPlayer .__init__ (self , phi = 1. / 9 , s = 0.5 , l = P )
166
+ self .init_args = ()
160
167
161
168
162
169
### Strategies for recreating tournaments
@@ -174,6 +181,7 @@ def __init__(self, q=0.9):
174
181
four_vector = (1. , 1 - q , 1 , 1 - q )
175
182
super (self .__class__ , self ).__init__ (four_vector )
176
183
self .q = q
184
+ self .init_args = (q ,)
177
185
178
186
def __repr__ (self ):
179
187
return "%s: %s" % (self .name , round (self .q , 2 ))
0 commit comments