Skip to content
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

Merged
merged 7 commits into from
Nov 17, 2017
Merged

Added strategy Borufsen/k42r from Axelrod's second tourn #1139

merged 7 commits into from
Nov 17, 2017

Conversation

gaffney2010
Copy link
Member

Here are the fingerprints:

fortran_k42r
python_borufsen

@drvinceknight
Copy link
Member

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.

Copy link
Member

@drvinceknight drvinceknight left a 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?

def strategy(self, opponent: Player) -> Action:
turn = len(self.history) + 1

# Nip this case in the bud.
Copy link
Member

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.

self.cd_counts += 1

# Check if it's time for a mode change.
if turn > 2 and turn%25 == 2:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP8: turn % 25

self.mode = "Defect"

# Check for a random strategy
if (coops>=8 and coops<=17) and self.cc_counts*1.0/coops < 0.7:
Copy link
Member

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).

@drvinceknight
Copy link
Member

There's a failure on a meta strategy:

======================================================================
FAIL: test_strategy (axelrod.tests.strategies.test_meta.TestMetaMajorityLongMemory)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\axelrod\axelrod\tests\strategies\test_meta.py", line 340, in test_strategy
    expected_actions=actions, seed=1)
  File "C:\projects\axelrod\axelrod\tests\strategies\test_player.py", line 494, in versus_test
    self.assertEqual(match.play(), expected_actions)
AssertionError: Lists differ: [(C, C), (C, D), (D, C), (C, D), (D, C)] != [(C, C), (C, D), (C, C), (C, D), (D, C)]
First differing element 2:
(D, C)
(C, C)
- [(C, C), (C, D), (D, C), (C, D), (D, C)]
+ [(C, C), (C, D), (C, C), (C, D), (D, C)]
----------------------------------------------------------------------

(Just need to modify the expected actions in the test.)

@drvinceknight
Copy link
Member

I think we need both tests modified in this case (lines 338 of test_meta) need to be:

~ 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)  

Copy link
Member

@drvinceknight drvinceknight left a 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants