Skip to content

Commit ce822e0

Browse files
Merge pull request #745 from Nikoleta-v3/225
Adding to the documentation of initial Axelrod's tournaments strategies.
2 parents 2a7edcf + a29870b commit ce822e0

File tree

3 files changed

+76
-22
lines changed

3 files changed

+76
-22
lines changed

axelrod/strategies/axelrod_first.py

Lines changed: 58 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,16 @@
1212

1313

1414
class Davis(Player):
15-
"""A player starts by cooperating for 10 rounds then plays Grudger,
16-
defecting if at any point the opponent has defected."""
15+
"""
16+
Submitted to Axelrod's first tournament by Morton Davis.
17+
18+
A player starts by cooperating for 10 rounds then plays Grudger,
19+
defecting if at any point the opponent has defected.
20+
21+
Names:
22+
23+
- Davis: [Axelrod1980]_
24+
"""
1725

1826
name = 'Davis'
1927
classifier = {
@@ -49,8 +57,11 @@ def strategy(self, opponent):
4957

5058
class RevisedDowning(Player):
5159
"""Revised Downing attempts to determine if players are cooperative or not.
52-
If so, it cooperates with them. This strategy would have won Axelrod's first
53-
tournament.
60+
If so, it cooperates with them. This strategy would have won Axelrod's first tournament.
61+
62+
Names:
63+
64+
- Revised Downing: [Axelrod1980]_
5465
"""
5566

5667
name = "Revised Downing"
@@ -127,8 +138,14 @@ def reset(self):
127138

128139
class Feld(Player):
129140
"""
141+
Submitted to Axelrod's first tournament by Scott Feld.
142+
130143
Defects when opponent defects. Cooperates with a probability that decreases
131144
to 0.5 at round 200.
145+
146+
Names:
147+
148+
- Feld: [Axelrod1980]_
132149
"""
133150

134151
name = "Feld"
@@ -182,9 +199,15 @@ def strategy(self, opponent):
182199

183200
class Grofman(Player):
184201
"""
202+
Submitted to Axelrod's first tournament by Bernard Grofman.
203+
185204
Cooperate on the first 2 moves. Return opponent's move for the next 5.
186205
Then cooperate if the last round's moves were the same, otherwise cooperate
187206
with probability 2/7.
207+
208+
Names:
209+
210+
- Grofman: [Axelrod1980]_
188211
"""
189212

190213
name = "Grofman"
@@ -212,6 +235,8 @@ def strategy(self, opponent):
212235

213236
class Joss(MemoryOnePlayer):
214237
"""
238+
Submitted to Axelrod's first tournament by Johann Joss.
239+
215240
Cooperates with probability 0.9 when the opponent cooperates, otherwise
216241
emulates Tit-For-Tat.
217242
@@ -242,21 +267,18 @@ def __repr__(self):
242267

243268
class Nydegger(Player):
244269
"""
245-
The program begins with tit for tat for the first three moves, except that
246-
if it was the only one to cooperate on the first move and the only one to
247-
defect on the second move, it defects on the third move. After the third move,
248-
its choice is determined from the 3 preceding outcomes in the following manner.
249-
Let A be the sum formed by counting the other's defection as 2 points and one's
250-
own as 1 point, and giving weights of 16, 4, and 1 to the preceding three
251-
moves in chronological order. The choice can be described as defecting only
252-
when A equals 1, 6, 7, 17, 22, 23, 26, 29, 30, 31, 33, 38, 39, 45, 49, 54,
253-
55, 58, or 61. Thus if all three preceding moves are mutual defection,
254-
A = 63 and the rule cooperates. This rule was designed for use in laboratory
255-
experiments as a stooge which had a memory and appeared to be trustworthy,
256-
potentially cooperative, but not gullible.
257-
258-
-- Axelrod, "Effective Choice in the Prisoner's Dilemma"
270+
Submitted to Axelrod's first tournament by Rudy Nydegger.
271+
272+
The program begins with tit for tat for the first three moves, except
273+
that if it was the only one to cooperate on the first move and the only one to defect on the second move, it defects on the third move. After the third move, its choice is determined from the 3 preceding outcomes in the following manner.
274+
275+
Let A be the sum formed by counting the other's defection as 2 points and one's own as 1 point, and giving weights of 16, 4, and 1 to the preceding three moves in chronological order. The choice can be described as defecting only when A equals 1, 6, 7, 17, 22, 23, 26, 29, 30, 31, 33, 38, 39, 45, 49, 54, 55, 58, or 61.
259276
277+
Thus if all three preceding moves are mutual defection, A = 63 and the rule cooperates. This rule was designed for use in laboratory experiments as a stooge which had a memory and appeared to be trustworthy, potentially cooperative, but not gullible.
278+
279+
Names:
280+
281+
- Nydegger: [Axelrod1980]_
260282
"""
261283

262284
name = "Nydegger"
@@ -309,9 +331,15 @@ def strategy(self, opponent):
309331

310332
class Shubik(Player):
311333
"""
334+
Submitted to Axelrod's first tournament by Martin Shubik.
335+
312336
Plays like Tit-For-Tat with the following modification. After
313337
each retaliation, the number of rounds that Shubik retaliates
314338
increases by 1.
339+
340+
Names:
341+
342+
- Shubik: [Axelrod1980]_
315343
"""
316344

317345
name = 'Shubik'
@@ -371,8 +399,15 @@ def reset(self):
371399

372400
class Tullock(Player):
373401
"""
402+
Submitted to Axelrod's first tournament by Gordon Tullock.
403+
374404
Cooperates for the first 11 rounds then randomly cooperates 10% less often
375-
than the opponent has in previous rounds."""
405+
than the opponent has in previous rounds.
406+
407+
Names:
408+
409+
- Tullock: [Axelrod1980]_
410+
"""
376411

377412
name = "Tullock"
378413
classifier = {
@@ -423,7 +458,10 @@ class UnnamedStrategy(Player):
423458
score than the other player. Unfortunately, the complex process of adjustment
424459
frequently left the probability of cooperation in the 30% to 70% range, and
425460
therefore the rule appeared random to many other players.
426-
-- Axelrod, "Effective Choice in the Prisoner's Dilemma"
461+
462+
Names:
463+
464+
- Unnamed Strategy: [Axelrod1980]_
427465
428466
Warning: This strategy is not identical to the original strategy (source
429467
unavailable) and was written based on published descriptions.

axelrod/strategies/axelrod_second.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
class Champion(Player):
1313
"""
1414
Strategy submitted to Axelrod's second tournament by Danny Champion.
15+
16+
This player cooperates on the first 10 moves and plays Tit for Tat for the next 15 more moves. After 25 moves, the program cooperates unless all the following are true: the other player defected on the previous move, the other player cooperated less than 60% and the random number between 0 and 1 is greater that the other player's cooperation rate.
17+
18+
Names:
19+
20+
- Champion: [Axelrod1980b]_
1521
"""
1622

1723
name = "Champion"
@@ -48,6 +54,12 @@ def strategy(self, opponent):
4854
class Eatherley(Player):
4955
"""
5056
Strategy submitted to Axelrod's second tournament by Graham Eatherley.
57+
58+
A player that keeps track of how many times in the game the other player defected. After the other player defects, it defects with a probability equal to the ratio of the other's total defections to the total moves to that point.
59+
60+
Names:
61+
62+
- Eatherley: [Axelrod1980b]_
5163
"""
5264

5365
name = "Eatherley"
@@ -79,8 +91,11 @@ class Tester(Player):
7991
"""
8092
Submitted to Axelrod's second tournament by David Gladstein.
8193
82-
Defects on the first move and plays TFT if the opponent ever defects (after
83-
one apology cooperation round). Otherwise alternate cooperation and defection.
94+
Defects on the first move and plays Tit For Tat if the opponent ever defects (after one apology cooperation round). Otherwise alternate cooperation and defection.
95+
96+
Names:
97+
98+
- Tester: [Axelrod1980b]_
8499
"""
85100

86101
name = "Tester"

docs/reference/bibliography.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This is a collection of various bibliographic items referenced in the
77
documentation.
88

99
.. [Axelrod1980] Axelrod, R. (1980). Effective Choice in the Prisoner’s Dilemma. Journal of Conflict Resolution, 24(1), 3–25.
10+
.. [Axelrod1980b] Axelrod, R. (1980). More Effective Choice in the Prisoner’s Dilemma. Journal of Conflict Resolution, 24(3), 379-403.
1011
.. [Axelrod1984] The Evolution of Cooperation. Basic Books. ISBN 0-465-02121-2.
1112
.. [Axelrod1995] Wu, J. and Axelrod, R. (1995). How to cope with noise in the Iterated prisoner’s dilemma, Journal of Conflict Resolution, 39(1), pp. 183–189. doi: 10.1177/0022002795039001008.
1213
.. [Banks1980] Banks, J. S., & Sundaram, R. K. (1990). Repeated games, finite automata, and complexity. Games and Economic Behavior, 2(2), 97–117. http://doi.org/10.1016/0899-8256(90)90024-O

0 commit comments

Comments
 (0)