-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added strategy Borufsen/k42r from Axelrod's second tourn #1139
Conversation
I have run the axelrod-fortran test suite with this strategy (as it's deterministic), which tests it against a range of opponents, and it has passed. Coupled with the fingerprints I think it's safe to say this strategy is correctly implemented here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also update the documentation for the second tournament (docs/reference/overview_of_strategies.rst
) please?
axelrod/strategies/axelrod_second.py
Outdated
def strategy(self, opponent: Player) -> Action: | ||
turn = len(self.history) + 1 | ||
|
||
# Nip this case in the bud. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this inline comment.
axelrod/strategies/axelrod_second.py
Outdated
self.cd_counts += 1 | ||
|
||
# Check if it's time for a mode change. | ||
if turn > 2 and turn%25 == 2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PEP8: turn % 25
axelrod/strategies/axelrod_second.py
Outdated
self.mode = "Defect" | ||
|
||
# Check for a random strategy | ||
if (coops>=8 and coops<=17) and self.cc_counts*1.0/coops < 0.7: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PEP8:
(coops >= 8 and coops <= 17) and self.cc_counts / coops < 0.7:
(I believe there's no need for 1.0 / coops
as this is py3+ so will assume float division).
There's a failure on a meta strategy:
(Just need to modify the expected actions in the test.) |
I think we need both tests modified in this case (lines 338 of ~ 338 actions = [(C, C), (C, D), (D, C), (C, D), (D, C)]
339 self.versus_test(opponent=axelrod.Alternator(),
340 expected_actions=actions, seed=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Here are the fingerprints: