@@ -15,6 +15,12 @@ class AbstractAdaptor(Player):
15
15
round of play. Using this state the player Cooperates with a probability
16
16
derived from the state.
17
17
18
+ The strategy relies on one internal state and two parameters:
19
+ s, float: the internal state, initially 0
20
+ perr, float: an error threshold for misinterpreted moves
21
+ delta, a dictionary of floats: additive update values for s depending
22
+ on the last round's outcome
23
+
18
24
Names:
19
25
20
26
- Adaptor: [Hauert2002]_
@@ -32,18 +38,18 @@ class AbstractAdaptor(Player):
32
38
"manipulates_state" : False ,
33
39
}
34
40
35
- def __init__ (self , d : Dict [Tuple [Action , Action ], float ],
41
+ def __init__ (self , delta : Dict [Tuple [Action , Action ], float ],
36
42
perr : float = 0.01 ) -> None :
37
43
super ().__init__ ()
38
44
self .perr = perr
39
- self .d = d
45
+ self .delta = delta
40
46
self .s = 0.
41
47
42
48
def strategy (self , opponent : Player ) -> Action :
43
49
if self .history :
44
50
# Update internal state from the last play
45
51
last_round = (self .history [- 1 ], opponent .history [- 1 ])
46
- self .s += self .d [last_round ]
52
+ self .s += self .delta [last_round ]
47
53
48
54
# Compute probability of Cooperation
49
55
p = self .perr + (1.0 - 2 * self .perr ) * (
@@ -66,12 +72,13 @@ class AdaptorBrief(AbstractAdaptor):
66
72
name = "AdaptorBrief"
67
73
68
74
def __init__ (self ) -> None :
69
- d = {(C , C ): 0. , # R
70
- (C , D ): - 1.001505 , # S
71
- (D , C ): 0.992107 , # T
72
- (D , D ): - 0.638734 # P
73
- }
74
- super ().__init__ (d = d )
75
+ delta = {
76
+ (C , C ): 0. , # R
77
+ (C , D ): - 1.001505 , # S
78
+ (D , C ): 0.992107 , # T
79
+ (D , D ): - 0.638734 # P
80
+ }
81
+ super ().__init__ (delta = delta )
75
82
76
83
77
84
class AdaptorLong (AbstractAdaptor ):
@@ -87,9 +94,10 @@ class AdaptorLong(AbstractAdaptor):
87
94
name = "AdaptorLong"
88
95
89
96
def __init__ (self ) -> None :
90
- d = {(C , C ): 0. , # R
91
- (C , D ): 1.888159 , # S
92
- (D , C ): 1.858883 , # T
93
- (D , D ): - 0.995703 # P
94
- }
95
- super ().__init__ (d = d )
97
+ delta = {
98
+ (C , C ): 0. , # R
99
+ (C , D ): 1.888159 , # S
100
+ (D , C ): 1.858883 , # T
101
+ (D , D ): - 0.995703 # P
102
+ }
103
+ super ().__init__ (delta = delta )
0 commit comments