@@ -65,15 +65,19 @@ def strategy(self, opponent):
6565class GTFT (MemoryOnePlayer ):
6666 """Generous Tit-For-Tat Strategy."""
6767
68- name = 'Generous Tit-For-Tat '
68+ name = 'GTFT '
6969
7070 def __init__ (self , p = None ):
7171 (R , P , S , T ) = Game ().RPST ()
7272 if not p :
7373 p = min (1 - float (T - R ) / (R - S ), float (R - P ) / (T - P ))
74+ self .p = p
7475 four_vector = [1 , p , 1 , p ]
7576 super (self .__class__ , self ).__init__ (four_vector )
7677
78+ def __repr__ (self ):
79+ return "%s: %s" % (self .name , round (self .p , 2 ))
80+
7781
7882class StochasticCooperator (MemoryOnePlayer ):
7983 """Stochastic Cooperator, http://www.nature.com/ncomms/2013/130801/ncomms3193/full/ncomms3193.html."""
@@ -171,8 +175,12 @@ class Joss(MemoryOnePlayer):
171175
172176 def __init__ (self , p = 0.9 ):
173177 four_vector = (p , 0 , p , 0 )
178+ self .p = p
174179 super (self .__class__ , self ).__init__ (four_vector )
175180
181+ def __repr__ (self ):
182+ return "%s: %s" % (self .name , round (self .p , 2 ))
183+
176184
177185class SoftJoss (MemoryOnePlayer ):
178186 """
@@ -185,3 +193,7 @@ class SoftJoss(MemoryOnePlayer):
185193 def __init__ (self , q = 0.9 ):
186194 four_vector = (1. , 1 - q , 1 , 1 - q )
187195 super (self .__class__ , self ).__init__ (four_vector )
196+ self .q = q
197+
198+ def __repr__ (self ):
199+ return "%s: %s" % (self .name , round (self .q , 2 ))
0 commit comments