Skip to content

Commit

Permalink
Change Grudger mem depth to 1.
Browse files Browse the repository at this point in the history
Reclassify. Had to adjust some tests:

- Expected classification ones in doctests and classification tests.
- Adjust a test for a meta player.
- Change some tests for reclassification of transformers (that used
Grudger as an example).

Closes #1064
  • Loading branch information
drvinceknight committed Jul 10, 2017
1 parent bb2a1f8 commit 63a8921
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion axelrod/strategies/grudger.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Grudger(Player):

name = 'Grudger'
classifier = {
'memory_depth': float('inf'), # Long memory
'memory_depth': 1,
'stochastic': False,
'makes_use_of': set(),
'long_run_time': False,
Expand Down
2 changes: 1 addition & 1 deletion axelrod/tests/strategies/test_grudger.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TestGrudger(TestPlayer):
name = "Grudger"
player = axl.Grudger
expected_classifier = {
'memory_depth': float('inf'), # Long memory
'memory_depth': 1,
'stochastic': False,
'makes_use_of': set(),
'long_run_time': False,
Expand Down
2 changes: 1 addition & 1 deletion axelrod/tests/strategies/test_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class TestMetaMajorityMemoryOne(TestMetaPlayer):
}

def test_strategy(self):
actions = [(C, C), (C, D), (C, C), (C, D), (D, C)]
actions = [(C, C), (C, D), (D, C), (C, D), (D, C)]
self.versus_test(opponent=axelrod.Alternator(),
expected_actions=actions)

Expand Down
1 change: 0 additions & 1 deletion axelrod/tests/unit/test_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def test_is_basic(self):
axl.ForgivingTitForTat,
axl.GoByMajority20,
axl.GTFT,
axl.Grudger,
axl.Inverse,
axl.Random]

Expand Down
4 changes: 2 additions & 2 deletions axelrod/tests/unit/test_strategy_transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def test_initial_transformer(self):
p1.play(p2)
self.assertEqual(p2.history, [D, D, C, D, C])

p3 = InitialTransformer([D, D])(axelrod.Grudger)()
p3 = InitialTransformer([D, D])(axelrod.Adaptive)()
self.assertEqual(p3.classifier["memory_depth"], float('inf'))

def test_final_transformer(self):
Expand All @@ -286,7 +286,7 @@ def test_final_transformer(self):
p1.play(p2)
self.assertEqual(p2.history, [C, C, C, D, D, D, C, C])

p3 = FinalTransformer([D, D])(axelrod.Grudger)()
p3 = FinalTransformer([D, D])(axelrod.Adaptive)()
self.assertEqual(p3.classifier["memory_depth"], float('inf'))

def test_final_transformer2(self):
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/advanced/classification_of_strategies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ make a decision::
... }
>>> strategies = axl.filtered_strategies(filterset)
>>> len(strategies)
27
28

Multiple filters can be specified within the filterset dictionary. To specify a
range of memory_depth values, we can use the 'min_memory_depth' and
Expand All @@ -69,7 +69,7 @@ range of memory_depth values, we can use the 'min_memory_depth' and
... }
>>> strategies = axl.filtered_strategies(filterset)
>>> len(strategies)
50
51

We can also identify strategies that make use of particular properties of the
tournament. For example, here is the number of strategies that make use of the
Expand Down

0 comments on commit 63a8921

Please sign in to comment.