Skip to content

Commit

Permalink
Merge 2645f71 into 4fb14c8
Browse files Browse the repository at this point in the history
  • Loading branch information
drvinceknight committed Aug 14, 2018
2 parents 4fb14c8 + 2645f71 commit b13df80
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions axelrod/strategies/lookerup.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,9 @@ def _get_initial_actions(self, initial_actions: tuple) -> tuple:
return initial_actions[:table_depth]

def strategy(self, opponent: Player) -> Reaction:
while self._initial_actions_pool:
return self._initial_actions_pool.pop(0)
turn_index = len(opponent.history)
while turn_index < len(self._initial_actions_pool):
return self._initial_actions_pool[turn_index]

player_last_n_plays = get_last_n_plays(player=self,
depth=self._lookup.player_depth)
Expand Down
11 changes: 11 additions & 0 deletions axelrod/tests/strategies/test_geller.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ def test_strategy(self):
self.versus_test(axelrod.Cooperator(), expected_actions=[(C, C)] * 5)
self.versus_test(axelrod.Alternator(), expected_actions=[(C, C), (D, D)] * 5)


def test_strategy_against_lookerup_players(self):
"""
Regression test for a bug discussed in
https://github.com/Axelrod-Python/Axelrod/issues/1185
"""
self.versus_test(axelrod.EvolvedLookerUp1_1_1(),
expected_actions=[(C, C), (C, C)])
self.versus_test(axelrod.EvolvedLookerUp2_2_2(),
expected_actions=[(C, C), (C, C)])

def test_returns_foil_inspection_strategy_of_opponent(self):
seed = 2
# each Geller type returns the other's foil_inspection_strategy
Expand Down

0 comments on commit b13df80

Please sign in to comment.