Skip to content

Commit

Permalink
Merge 45bc090 into 09b776a
Browse files Browse the repository at this point in the history
  • Loading branch information
marcharper committed Mar 3, 2020
2 parents 09b776a + 45bc090 commit b2015cd
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions axelrod/strategies/axelrod_first.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def strategy(self, opponent: Player) -> Action:
return D
return C


class FirstByDowning(Player):
"""
Submitted to Axelrod's first tournament by Downing
Expand Down Expand Up @@ -257,19 +258,20 @@ def strategy(self, opponent: Player) -> Action:
self.number_opponent_cooperations_in_response_to_C += 1
return D


if self.history[-2] == C and opponent.history[-1] == C:
self.number_opponent_cooperations_in_response_to_C += 1
if self.history[-2] == D and opponent.history[-1] == C:
self.number_opponent_cooperations_in_response_to_D += 1

# Adding 1 to cooperations for assumption that first opponent move
# being a response to a cooperation. See docstring for more
# information.
alpha = (self.number_opponent_cooperations_in_response_to_C /
(self.cooperations + 1)) # Adding 1 to count for assumption
# that first opponent move being a
# response to a cooperation. See
# docstring for more information.
(self.cooperations + 1))
# Adding 2 to defections on the assumption that the first two
# moves are defections, which may not be true in a noisy match
beta = (self.number_opponent_cooperations_in_response_to_D /
(self.defections))
max(self.defections, 2))

R, P, S, T = self.match_attributes["game"].RPST()
expected_value_of_cooperating = alpha * R + (1 - alpha) * S
Expand Down

0 comments on commit b2015cd

Please sign in to comment.