Skip to content

Commit 353bf46

Browse files
drvinceknightmarcharper
authored andcommitted
Remove further unused utils.
1 parent 4c0ada7 commit 353bf46

File tree

2 files changed

+0
-66
lines changed

2 files changed

+0
-66
lines changed

axelrod/_strategy_utils.py

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -45,55 +45,6 @@ def detect_cycle(history, min_size=1, max_size=12, offset=0):
4545
return None
4646

4747

48-
def inspect_strategy(inspector, opponent):
49-
"""Inspects the strategy of an opponent.
50-
51-
Simulate one round of play with an opponent, unless the opponent has
52-
an inspection countermeasure.
53-
54-
Parameters
55-
----------
56-
inspector: Player
57-
The player doing the inspecting
58-
opponent: Player
59-
The player being inspected
60-
61-
Returns
62-
-------
63-
Action
64-
The action that would be taken by the opponent.
65-
"""
66-
if hasattr(opponent, "foil_strategy_inspection"):
67-
return opponent.foil_strategy_inspection()
68-
else:
69-
return opponent.strategy(inspector)
70-
71-
72-
def _calculate_scores(p1, p2, game):
73-
"""Calculates the scores for two players based their history.
74-
75-
Parameters
76-
----------
77-
p1: Player
78-
The first player.
79-
p2: Player
80-
The second player.
81-
game: Game
82-
Game object used to score rounds in the players' histories.
83-
84-
Returns
85-
-------
86-
int, int
87-
The scores for the two input players.
88-
"""
89-
s1, s2 = 0, 0
90-
for pair in zip(p1.history, p2.history):
91-
score = game.score(pair)
92-
s1 += score[0]
93-
s2 += score[1]
94-
return s1, s2
95-
96-
9748
@lru_cache()
9849
def recursive_thue_morse(n):
9950
"""The recursive definition of the Thue-Morse sequence.

axelrod/tests/unit/test_strategy_utils.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import axelrod as axl
55
from axelrod._strategy_utils import (
66
detect_cycle,
7-
inspect_strategy,
87
recursive_thue_morse,
98
thue_morse_generator,
109
)
@@ -64,22 +63,6 @@ def test_cycle_greater_than_max_size_returns_none(self):
6463
self.assertIsNone(detect_cycle([C, C, D] * 2, min_size=1, max_size=2))
6564

6665

67-
class TestInspectStrategy(unittest.TestCase):
68-
def test_strategies_without_countermeasures_return_their_strategy(self):
69-
tft = axl.TitForTat()
70-
inspector = axl.Alternator()
71-
match = axl.Match((tft, inspector), turns=1)
72-
match.play()
73-
self.assertEqual(tft.history, [C])
74-
self.assertEqual(inspect_strategy(inspector=inspector, opponent=tft), C)
75-
76-
match = axl.Match((tft, inspector), turns=2)
77-
match.play()
78-
self.assertEqual(tft.history, [C, C])
79-
self.assertEqual(inspect_strategy(inspector=inspector, opponent=tft), D)
80-
self.assertEqual(tft.strategy(inspector), D)
81-
82-
8366
class TestRecursiveThueMorse(unittest.TestCase):
8467
def test_initial_values(self):
8568
self.assertEqual(recursive_thue_morse(0), 0)

0 commit comments

Comments
 (0)