Skip to content

Commit 26418a7

Browse files
committed
Merged changes from master.
2 parents 32f9c31 + 370feef commit 26418a7

File tree

16 files changed

+141
-30
lines changed

16 files changed

+141
-30
lines changed

CHANGES.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
# v3.11.0, 2018-01-09
2+
3+
A number of strategies from Axelrod's original second tournament, new tests and
4+
minor documentation changes.
5+
6+
- Implemented GraaskampKatzen (k60r)
7+
https://github.com/Axelrod-Python/Axelrod/pull/1144
8+
- Implemented Weiner (k41r)
9+
https://github.com/Axelrod-Python/Axelrod/pull/1145
10+
- Implemented Harrington (k75r)
11+
https://github.com/Axelrod-Python/Axelrod/pull/1146
12+
- Implemented MoreTidemanAndChieruzzi (k84r)
13+
https://github.com/Axelrod-Python/Axelrod/pull/1147
14+
- Implemented Getzler (k35r) strategy
15+
https://github.com/Axelrod-Python/Axelrod/pull/1151
16+
- Implemented Leyvraz (k86r) strategy
17+
https://github.com/Axelrod-Python/Axelrod/pull/1153
18+
- Implemented White (k72r) strategy
19+
https://github.com/Axelrod-Python/Axelrod/pull/1154
20+
- Implemented Black (k83r) strategy
21+
https://github.com/Axelrod-Python/Axelrod/pull/1155
22+
- Add a test for memory depth
23+
https://github.com/Axelrod-Python/Axelrod/pull/1157
24+
- Fix implementation of TidemanAndChieruzzi
25+
https://github.com/Axelrod-Python/Axelrod/pull/1152
26+
- Modify implementation of strategy
27+
https://github.com/Axelrod-Python/Axelrod/pull/1143
28+
- Update python version requirements
29+
https://github.com/Axelrod-Python/Axelrod/pull/1158
30+
- Add citations section to README
31+
https://github.com/Axelrod-Python/Axelrod/pull/1148
32+
https://github.com/Axelrod-Python/Axelrod/pull/1150
33+
34+
https://github.com/Axelrod-Python/Axelrod/compare/v3.11.0...v3.10.0
35+
136
# v3.10.0, 2017-11-27
237

338
One new strategy

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ a peer reviewed paper introducing the library (22 authors).
7474
Installation
7575
------------
7676

77-
The library requires Python 3.4 or greater. It will not run on Python 2.
77+
The library requires Python 3.5 or greater.
7878

7979
The simplest way to install is::
8080

@@ -127,7 +127,7 @@ Publications
127127
* Vincent Knight, Owen Campbell, Marc Harper, Karol Langner et al. `An Open Framework for the Reproducible Study of the Iterated Prisoner’s Dilemma. <https://openresearchsoftware.metajnl.com/articles/10.5334/jors.125/>`_ Journal of Open Research Software 4, no. 1 (2016). (`ArXiv Preprint <https://arxiv.org/abs/1604.00896>`_)
128128

129129

130-
Contributors
130+
Contributors
131131
------------
132132

133133
The library has had many awesome contributions from many `great

axelrod/strategies/axelrod_first.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ class SteinAndRapoport(Player):
529529

530530
name = 'Stein and Rapoport'
531531
classifier = {
532-
'memory_depth': 15,
532+
'memory_depth': float("inf"),
533533
'stochastic': False,
534534
'makes_use_of': {"length"},
535535
'long_run_time': False,

axelrod/strategies/geller.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Geller(Player):
4040

4141
name = 'Geller'
4242
classifier = {
43-
'memory_depth': -1,
43+
'memory_depth': float("inf"),
4444
'stochastic': True,
4545
'makes_use_of': set(),
4646
'long_run_time': False,
@@ -74,7 +74,7 @@ class GellerCooperator(Geller):
7474
"""
7575
name = 'Geller Cooperator'
7676
classifier = {
77-
'memory_depth': -1,
77+
'memory_depth': float("inf"),
7878
'stochastic': False,
7979
'makes_use_of': set(),
8080
'long_run_time': False,
@@ -101,7 +101,7 @@ class GellerDefector(Geller):
101101
"""
102102
name = 'Geller Defector'
103103
classifier = {
104-
'memory_depth': -1,
104+
'memory_depth': float("inf"),
105105
'stochastic': False,
106106
'makes_use_of': set(),
107107
'long_run_time': False,

axelrod/strategies/mindreader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class MindReader(Player):
2222

2323
name = 'Mind Reader'
2424
classifier = {
25-
'memory_depth': -10,
25+
'memory_depth': float("inf"),
2626
'stochastic': False,
2727
'makes_use_of': set(),
2828
'long_run_time': False,
@@ -60,7 +60,7 @@ class ProtectedMindReader(MindReader):
6060

6161
name = 'Protected Mind Reader'
6262
classifier = {
63-
'memory_depth': -10,
63+
'memory_depth': float("inf"),
6464
'stochastic': False,
6565
'makes_use_of': set(),
6666
'long_run_time': False,
@@ -90,7 +90,7 @@ class MirrorMindReader(ProtectedMindReader):
9090
name = 'Mirror Mind Reader'
9191

9292
classifier = {
93-
'memory_depth': -10,
93+
'memory_depth': float("inf"),
9494
'stochastic': False,
9595
'makes_use_of': set(),
9696
'long_run_time': False,

axelrod/strategies/titfortat.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class DynamicTwoTitsForTat(Player):
114114

115115
name = 'Dynamic Two Tits For Tat'
116116
classifier = {
117-
'memory_depth': 2, # Long memory, memory-2
117+
'memory_depth': float("inf"),
118118
'stochastic': True,
119119
'makes_use_of': set(),
120120
'long_run_time': False,
@@ -127,7 +127,7 @@ class DynamicTwoTitsForTat(Player):
127127
def strategy(opponent):
128128
# First move
129129
if not opponent.history:
130-
# Make sure we cooporate first turn
130+
# Make sure we cooperate first turn
131131
return C
132132
if D in opponent.history[-2:]:
133133
# Probability of cooperating regardless
@@ -826,6 +826,7 @@ def __init__(self, p: float=0.5) -> None:
826826
"""
827827
super().__init__()
828828
self.p = p
829+
self.act_random = False
829830
if p in [0, 1]:
830831
self.classifier['stochastic'] = False
831832

@@ -834,6 +835,10 @@ def strategy(self, opponent: Player) -> Action:
834835
"""This is the actual strategy"""
835836
if not self.history:
836837
return C
837-
if len(opponent.history) % 2 == 0:
838+
839+
if self.act_random:
840+
self.act_random = False
838841
return random_choice(self.p)
842+
843+
self.act_random = True
839844
return opponent.history[-1]

axelrod/tests/strategies/test_axelrod_first.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ class TestSteinAndRapoport(TestPlayer):
370370
name = "Stein and Rapoport: 0.05: (D, D)"
371371
player = axelrod.SteinAndRapoport
372372
expected_classifier = {
373-
'memory_depth': 15,
373+
'memory_depth': float("inf"),
374374
'long_run_time': False,
375375
'stochastic': False,
376376
'makes_use_of': {'length'},
@@ -524,11 +524,11 @@ def test_strategy(self):
524524
attrs={'fresh_start': False})
525525

526526
# check the fresh start condition: least 20 rounds since the last ‘fresh start’
527-
opponent = axelrod.Cycler('CCCCD')
528-
actions = [(C, C), (C, C), (C, C), (C, C), (C, D), (D, C), (C, C),
529-
(C, C), (C, C), (C, D), (D, C), (D, C), (C, C), (C, C),
530-
(C, D), (D, C), (D, C), (D, C), (C, C), (C, D), (D, C),
531-
(D, C), (D, C), (C, C), (C, D), (D, C), (C, C), (C, C),
527+
opponent = axelrod.Cycler('CCCCD')
528+
actions = [(C, C), (C, C), (C, C), (C, C), (C, D), (D, C), (C, C),
529+
(C, C), (C, C), (C, D), (D, C), (D, C), (C, C), (C, C),
530+
(C, D), (D, C), (D, C), (D, C), (C, C), (C, D), (D, C),
531+
(D, C), (D, C), (C, C), (C, D), (D, C), (C, C), (C, C),
532532
(C, C), (C, D), (D, C), (D, C), (C, C), (C, C), (C, D)]
533533
self.versus_test(opponent, expected_actions=actions,
534534
match_attributes={'length': 35},

axelrod/tests/strategies/test_geller.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class TestGeller(TestPlayer):
1111
name = "Geller"
1212
player = axelrod.Geller
1313
expected_classifier = {
14-
'memory_depth': -1,
14+
'memory_depth': float("inf"),
1515
'stochastic': True,
1616
'makes_use_of': set(),
1717
'long_run_time': False,
@@ -59,7 +59,7 @@ class TestGellerCooperator(TestGeller):
5959
name = "Geller Cooperator"
6060
player = axelrod.GellerCooperator
6161
expected_classifier = {
62-
'memory_depth': -1,
62+
'memory_depth': float("inf"),
6363
'stochastic': False,
6464
'makes_use_of': set(),
6565
'long_run_time': False,
@@ -85,7 +85,7 @@ class TestGellerDefector(TestGeller):
8585
name = "Geller Defector"
8686
player = axelrod.GellerDefector
8787
expected_classifier = {
88-
'memory_depth': -1,
88+
'memory_depth': float("inf"),
8989
'stochastic': False,
9090
'makes_use_of': set(),
9191
'long_run_time': False,

axelrod/tests/strategies/test_meta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ class TestNMWELongMemory(TestMetaPlayer):
563563
}
564564

565565
def test_strategy(self):
566-
actions = [(C, C), (C, D), (D, C), (C, D), (D, C)]
566+
actions = [(C, C), (C, D), (D, C), (D, D), (D, C)]
567567
self.versus_test(opponent=axelrod.Alternator(),
568568
expected_actions=actions)
569569

axelrod/tests/strategies/test_mindreader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class TestMindReader(TestPlayer):
1313
name = "Mind Reader"
1414
player = axelrod.MindReader
1515
expected_classifier = {
16-
'memory_depth': -10,
16+
'memory_depth': float("inf"),
1717
'stochastic': False,
1818
'makes_use_of': set(),
1919
'long_run_time': False,
@@ -104,7 +104,7 @@ class TestProtectedMindReader(TestPlayer):
104104
name = "Protected Mind Reader"
105105
player = axelrod.ProtectedMindReader
106106
expected_classifier = {
107-
'memory_depth': -10,
107+
'memory_depth': float("inf"),
108108
'stochastic': False,
109109
'makes_use_of': set(),
110110
'long_run_time': False,
@@ -148,7 +148,7 @@ class TestMirrorMindReader(TestPlayer):
148148
name = 'Mirror Mind Reader'
149149
player = axelrod.MirrorMindReader
150150
expected_classifier = {
151-
'memory_depth': -10,
151+
'memory_depth': float("inf"),
152152
'stochastic': False,
153153
'makes_use_of': set(),
154154
'long_run_time': False,

0 commit comments

Comments
 (0)