@@ -1604,7 +1604,7 @@ class RichardHufford(Player):
1604
1604
Strategy submitted to Axelrod's second tournament by Richard Hufford (K47R)
1605
1605
and came in sixteenth in that tournament.
1606
1606
1607
- The strategy tracks opponent "agreements," that is whenever the opponent's
1607
+ The strategy tracks opponent "agreements", that is whenever the opponent's
1608
1608
previous move is the some as this player's move two turns ago. If the
1609
1609
opponent's first move is a Defection, this is counted as a disagreement,
1610
1610
and otherwise an agreement. From the agreement counts, two measures are
@@ -1625,7 +1625,7 @@ class RichardHufford(Player):
1625
1625
1626
1626
However, if the opponent has Cooperated the last `streak_needed` turns,
1627
1627
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
1629
1629
aberration, the strategy doesn't override, even if there's a streak of
1630
1630
Cooperations. Two turns after an aberration, the strategy: Restarts the
1631
1631
Cooperation streak (never looking before this turn); Cooperates; and
@@ -1662,8 +1662,8 @@ def __init__(self) -> None:
1662
1662
self .streak_needed = 21
1663
1663
self .current_streak = 2
1664
1664
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
1667
1667
1668
1668
def strategy (self , opponent : Player ) -> Action :
1669
1669
turn = len (self .history ) + 1
@@ -1681,7 +1681,7 @@ def strategy(self, opponent: Player) -> Action:
1681
1681
else :
1682
1682
self .last_four_agreements [self .last_four_index ] = 0
1683
1683
1684
- # Check is last_aberration is infinite.
1684
+ # Check if last_aberration is infinite.
1685
1685
# i.e Not an aberration in last two turns.
1686
1686
if turn < self .last_aberration :
1687
1687
if opponent .history [- 1 ] == C :
@@ -1695,10 +1695,10 @@ def strategy(self, opponent: Player) -> Action:
1695
1695
elif turn == self .last_aberration + 2 :
1696
1696
self .last_aberration = float ("inf" )
1697
1697
if opponent .history [- 1 ] == C :
1698
- self .num_abb_coop += 1
1698
+ self .coop_after_ab_count += 1
1699
1699
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
1702
1702
self .current_streak = 0
1703
1703
return C
1704
1704
@@ -1708,5 +1708,4 @@ def strategy(self, opponent: Player) -> Action:
1708
1708
return C
1709
1709
elif proportion_agree >= 0.625 and last_four_num >= 2 :
1710
1710
return opponent .history [- 1 ]
1711
- else :
1712
- return D
1711
+ return D
0 commit comments