Skip to content

Commit 1d3d81f

Browse files
authored
Merge pull request #1023 from Axelrod-Python/884-prober
Refactor tests for Prober.
2 parents 7a65c17 + e0f5359 commit 1d3d81f

File tree

2 files changed

+174
-139
lines changed

2 files changed

+174
-139
lines changed

axelrod/strategies/prober.py

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class CollectiveStrategy(Player):
13-
"""Defined in [Li2009]. 'It always cooperates in the first move and defects
13+
"""Defined in [Li2009]_. 'It always cooperates in the first move and defects
1414
in the second move. If the opponent also cooperates in the first move and
1515
defects in the second move, CS will cooperate until the opponent defects.
1616
Otherwise, CS will always defect.'
@@ -50,6 +50,10 @@ class Prober(Player):
5050
"""
5151
Plays D, C, C initially. Defects forever if opponent cooperated in moves 2
5252
and 3. Otherwise plays TFT.
53+
54+
Names:
55+
56+
- Prober [Li2011]_
5357
"""
5458

5559
name = 'Prober'
@@ -83,6 +87,10 @@ class Prober2(Player):
8387
"""
8488
Plays D, C, C initially. Cooperates forever if opponent played D then C
8589
in moves 2 and 3. Otherwise plays TFT.
90+
91+
Names:
92+
93+
- Prober 2: [Prison1998]_
8694
"""
8795

8896
name = 'Prober 2'
@@ -116,6 +124,10 @@ class Prober3(Player):
116124
"""
117125
Plays D, C initially. Defects forever if opponent played C in moves 2.
118126
Otherwise plays TFT.
127+
128+
Names:
129+
130+
- Prober 3: [Prison1998]_
119131
"""
120132

121133
name = 'Prober 3'
@@ -153,7 +165,7 @@ class Prober4(Player):
153165
154166
Names:
155167
156-
- prober4: [Prison1998]_
168+
- Prober 4: [Prison1998]_
157169
"""
158170

159171
name = 'Prober 4'
@@ -208,6 +220,10 @@ class HardProber(Player):
208220
"""
209221
Plays D, D, C, C initially. Defects forever if opponent cooperated in moves
210222
2 and 3. Otherwise plays TFT.
223+
224+
Names:
225+
226+
- Hard Prober: [Prison1998]_
211227
"""
212228

213229
name = 'Hard Prober'
@@ -243,10 +259,9 @@ class NaiveProber(Player):
243259
"""
244260
Like tit-for-tat, but it occasionally defects with a small probability.
245261
246-
For reference see: "Engineering Design of Strategies for Winning
247-
Iterated Prisoner's Dilemma Competitions" by Jiawei Li, Philip Hingston,
248-
and Graham Kendall. IEEE TRANSACTIONS ON COMPUTATIONAL INTELLIGENCE AND AI
249-
IN GAMES, VOL. 3, NO. 4, DECEMBER 2011
262+
Names:
263+
264+
- Naive Prober: [Li2011]_
250265
"""
251266

252267
name = 'Naive Prober'
@@ -289,17 +304,16 @@ class RemorsefulProber(NaiveProber):
289304
Like Naive Prober, but it remembers if the opponent responds to a random
290305
defection with a defection by being remorseful and cooperating.
291306
292-
For reference see: "Engineering Design of Strategies for Winning
293-
Iterated Prisoner's Dilemma Competitions" by Jiawei Li, Philip Hingston,
294-
and Graham Kendall. IEEE TRANSACTIONS ON COMPUTATIONAL INTELLIGENCE AND AI
295-
IN GAMES, VOL. 3, NO. 4, DECEMBER 2011
296-
297-
A more complete description is given in "The Selfish Gene"
298-
(https://books.google.co.uk/books?id=ekonDAAAQBAJ):
307+
For reference see: [Li2011]_. A more complete description is given in "The
308+
Selfish Gene" (https://books.google.co.uk/books?id=ekonDAAAQBAJ):
299309
300310
"Remorseful Prober remembers whether it has just spontaneously defected, and
301311
whether the result was prompt retaliation. If so, it 'remorsefully' allows
302312
its opponent 'one free hit' without retaliating."
313+
314+
Names:
315+
316+
- Remorseful Prober: [Li2011]_
303317
"""
304318

305319
name = 'Remorseful Prober'

0 commit comments

Comments
 (0)