Skip to content

Commit 2897d57

Browse files
committed
Fix memory depth bug revealed by test
1 parent 3402207 commit 2897d57

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

axelrod/strategies/shortmem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ShortMem(Player):
2222

2323
name = "ShortMem"
2424
classifier = {
25-
"memory_depth": 10,
25+
"memory_depth": float('inf'),
2626
"stochastic": False,
2727
"makes_use_of": set(),
2828
"long_run_time": False,

axelrod/tests/strategies/test_meta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ class TestMetaMajorityFiniteMemory(TestMetaPlayer):
369369
}
370370

371371
def test_strategy(self):
372-
actions = [(C, C), (C, D), (D, C), (C, D), (C, C)]
372+
actions = [(C, C), (C, D), (D, C), (C, D), (D, C)]
373373
self.versus_test(opponent=axelrod.Alternator(), expected_actions=actions)
374374

375375

axelrod/tests/strategies/test_player.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ def test_memory_depth_upper_bound(self, strategies, seed, turns):
491491
memory = player.classifier["memory_depth"]
492492
if memory < float("inf"):
493493
for strategy in strategies:
494+
player.reset()
494495
opponent = strategy()
495496
self.assertTrue(
496497
test_memory(

axelrod/tests/strategies/test_shortmem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
C, D = axelrod.Action.C, axelrod.Action.D
88

99

10-
class TestCooperator(TestPlayer):
10+
class TestShortMem(TestPlayer):
1111

1212
name = "ShortMem"
1313
player = axelrod.ShortMem
1414
expected_classifier = {
15-
"memory_depth": 10,
15+
"memory_depth": float('inf'),
1616
"stochastic": False,
1717
"makes_use_of": set(),
1818
"inspects_source": False,

0 commit comments

Comments
 (0)