Skip to content

Commit c543312

Browse files
committed
Tests and strategy references
1 parent 13abe80 commit c543312

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

axelrod/strategies/mutual.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55

66

77
class Desperate(Player):
8-
"""A player that only cooperates after mutual defection"""
8+
"""A player that only cooperates after mutual defection.
9+
10+
Names:
11+
12+
- Desperate: [Berg2015]_"""
13+
914
name = "Desperate"
1015
classifier = {
1116
'memory_depth': 1,
@@ -26,7 +31,12 @@ def strategy(self, opponent):
2631

2732

2833
class Hopeless(Player):
29-
"""A player that only defects after mutual cooperation"""
34+
"""A player that only defects after mutual cooperation.
35+
36+
Names:
37+
38+
- Hopeless: [Berg2015]_"""
39+
3040
name = "Hopeless"
3141
classifier = {
3242
'memory_depth': 1,
@@ -47,7 +57,12 @@ def strategy(self, opponent):
4757

4858

4959
class Willing(Player):
50-
"""A player that only defects after mutual defection"""
60+
"""A player that only defects after mutual defection.
61+
62+
Names:
63+
64+
- Willing: [Berg2015]_"""
65+
5166
name = "Willing"
5267
classifier = {
5368
'memory_depth': 1,

axelrod/tests/unit/test_mutual.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class TestDesperate(TestPlayer):
2424
def test_strategy(self):
2525
seed(1)
2626
self.first_play_test(C)
27+
seed(2)
28+
self.first_play_test(D)
2729

2830
def test_responses(self):
2931
self.responses_test([C] * 4, [D] * 4, [D])
@@ -48,6 +50,8 @@ class TestHopeless(TestPlayer):
4850
def test_strategy(self):
4951
seed(1)
5052
self.first_play_test(C)
53+
seed(2)
54+
self.first_play_test(D)
5155

5256
def test_responses(self):
5357
self.responses_test([C] * 4, [D] * 4, [C])
@@ -71,6 +75,8 @@ class TestWilling(TestPlayer):
7175
def test_strategy(self):
7276
seed(1)
7377
self.first_play_test(C)
78+
seed(2)
79+
self.first_play_test(D)
7480

7581
def test_responses(self):
7682
self.responses_test([C] * 4, [D] * 4, [C])

0 commit comments

Comments
 (0)