Skip to content

Commit 4b8616f

Browse files
authored
Merge pull request #1143 from Axelrod-Python/cave-patch
Use opponent.defections in Cave and some minor styling changes
2 parents 40c3c87 + 268a61e commit 4b8616f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

axelrod/strategies/axelrod_second.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ class Borufsen(Player):
595595
re-evaluate the mode. Enter defect mode if any of the following
596596
conditions hold:
597597
598-
- Detected random: Opponent cooperated 7-18 times since last mode
598+
- Detected random: Opponent cooperated 7-18 times since last mode
599599
evaluation (or start) AND less than 70% of opponent cooperation was in
600600
response to player's cooperation, i.e.
601601
cc_count / (cc_count+cd_count) < 0.7
@@ -757,12 +757,12 @@ class Cave(Player):
757757

758758
def strategy(self, opponent: Player) -> Action:
759759
turn = len(self.history) + 1
760-
if turn == 1: return C
760+
if turn == 1:
761+
return C
761762

762763
number_defects = opponent.defections
763764
perc_defects = number_defects / turn
764-
765-
# If overly defect or appears random
765+
# Defect if the opponent has defected often or appears random.
766766
if turn > 39 and perc_defects > 0.39:
767767
return D
768768
if turn > 29 and perc_defects > 0.65:

0 commit comments

Comments
 (0)