Skip to content

Commit 83bea78

Browse files
committed
Stylistic changes requested.
1 parent 26418a7 commit 83bea78

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

axelrod/strategies/axelrod_second.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,7 @@ class RichardHufford(Player):
16041604
Strategy submitted to Axelrod's second tournament by Richard Hufford (K47R)
16051605
and came in sixteenth in that tournament.
16061606
1607-
The strategy tracks opponent "agreements," that is whenever the opponent's
1607+
The strategy tracks opponent "agreements", that is whenever the opponent's
16081608
previous move is the some as this player's move two turns ago. If the
16091609
opponent's first move is a Defection, this is counted as a disagreement,
16101610
and otherwise an agreement. From the agreement counts, two measures are
@@ -1625,7 +1625,7 @@ class RichardHufford(Player):
16251625
16261626
However, if the opponent has Cooperated the last `streak_needed` turns,
16271627
then the strategy deviates from the usual strategy, and instead Defects.
1628-
(We call such deviation an "aberration.") In the turn immediately after an
1628+
(We call such deviation an "aberration".) In the turn immediately after an
16291629
aberration, the strategy doesn't override, even if there's a streak of
16301630
Cooperations. Two turns after an aberration, the strategy: Restarts the
16311631
Cooperation streak (never looking before this turn); Cooperates; and
@@ -1662,8 +1662,8 @@ def __init__(self) -> None:
16621662
self.streak_needed = 21
16631663
self.current_streak = 2
16641664
self.last_aberration = float("inf")
1665-
self.num_abb_coop = 2
1666-
self.num_abb_def = 2
1665+
self.coop_after_ab_count = 2
1666+
self.def_after_ab_count = 2
16671667

16681668
def strategy(self, opponent: Player) -> Action:
16691669
turn = len(self.history) + 1
@@ -1681,7 +1681,7 @@ def strategy(self, opponent: Player) -> Action:
16811681
else:
16821682
self.last_four_agreements[self.last_four_index] = 0
16831683

1684-
# Check is last_aberration is infinite.
1684+
# Check if last_aberration is infinite.
16851685
# i.e Not an aberration in last two turns.
16861686
if turn < self.last_aberration:
16871687
if opponent.history[-1] == C:
@@ -1695,10 +1695,10 @@ def strategy(self, opponent: Player) -> Action:
16951695
elif turn == self.last_aberration + 2:
16961696
self.last_aberration = float("inf")
16971697
if opponent.history[-1] == C:
1698-
self.num_abb_coop += 1
1698+
self.coop_after_ab_count += 1
16991699
else:
1700-
self.num_abb_def += 1
1701-
self.streak_needed = np.floor(20.0 * self.num_abb_def / self.num_abb_coop) + 1
1700+
self.def_after_ab_count += 1
1701+
self.streak_needed = np.floor(20.0 * self.def_after_ab_count / self.coop_after_ab_count) + 1
17021702
self.current_streak = 0
17031703
return C
17041704

@@ -1708,5 +1708,4 @@ def strategy(self, opponent: Player) -> Action:
17081708
return C
17091709
elif proportion_agree >= 0.625 and last_four_num >= 2:
17101710
return opponent.history[-1]
1711-
else:
1712-
return D
1711+
return D

0 commit comments

Comments
 (0)