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

Michaelos strategy #1091

Merged
merged 24 commits into from
Jul 30, 2017
Merged

Michaelos strategy #1091

merged 24 commits into from
Jul 30, 2017

Conversation

dmanc
Copy link
Contributor

@dmanc dmanc commented Jul 27, 2017

Implemented a strategy from this link (specifically letter H) mentioned in #379. For some reason it shows commits that I pulled from upstream, are those supposed to be there?

Chadys and others added 22 commits July 26, 2017 18:56
Closes Axelrod-Python#1085

This doesn't fix that issue so to speak although it does just fix
matplotlib as a strict requirement. The current check does not work.
Currently when we pip install axelrod we also install hypothesis.

This is however only used for development. I've added a tweak to the
setup.py file to just remove it from the read in requirements.

I don't think we need to adjust the contributing documentation as `pip
install -r requirements` will still install hypothesis.
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.

This is looking great @dmanc!

I think the classification is not correct for the memory depth.

This change will impact the failing tests. They're both failures on strategies called Meta strategies which make use of teams of other strategies.

The first TestMetaMajorityMemoryOne is a player that uses a team of Memory One players so this will no longer be the case (as the player is not memory one).

The second TestNMWEStochastic is a failure for the stochastic players. That might indeed need to change (so you can just tweak the test).

return D
if self.history[-1] == D and opponent.history[-1] == C:
decision = random_choice()
if(decision == C):
Copy link
Member

Choose a reason for hiding this comment

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

PEP8:

if decision == C:


name = 'Michaelos'
classifier = {
'memory_depth': 1,
Copy link
Member

Choose a reason for hiding this comment

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

I believe that the memory depth is not 1.

If on turn n Michaelos defects and the opponent cooperates then 50% of the time I defect and defect throughout, However if I have already become a defector than I will defect 100% of the time so I not only need to know the previous turns (that I D and you C but I also need to know if I D'd because I have already "transformed" in to a defector).

I believe the memory depth is in fact float('inf'):

If our actions are ...(D, D), (D, C) then I do not know if my previous plays of D are TfT retaliations or because I have previously been turned in to a defector so I do not know if I need to randomly sample as a result of the last round being (D, C).

attrs={"is_defector": False},
match_attributes={"length": -1}, seed=2)

# Chance of becoming a defector is 50% after (D, C) occurs.
Copy link
Member

Choose a reason for hiding this comment

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

Could you repeat this test with a different seed to show differing behaviour after (C, D) (so only need 4 round please):

actions = [(C, C), (C, D), (C, C), (C, D)]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wait, I don't think this scenario is possible for the strategy unless I am misinterpreting something. After (C, D) Michaelos will play D since it is still playing like Tit-for-Tat.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the second test, does tweaking the test mean changing the expected actions?

Copy link
Member

Choose a reason for hiding this comment

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

After (C, D) Michaelos will play D since it is still playing like Tit-for-Tat.

Sorry you're correct, that was a typo from me, I simply mean to include a random seed version to illustrate that 50% of the time after (D, C) (not (C, D) - sorry) the strategy will cooperate **and ** is_defector will be False (so kind of like your seed=1 test but without the second (C, D).

For the second test, does tweaking the test mean changing the expected actions?

Yes.

@dmanc
Copy link
Contributor Author

dmanc commented Jul 30, 2017

How do I fix the Travis build error for python 3.5?

@drvinceknight
Copy link
Member

I've set the build going again. It's hypothesis (a tool to find random test scenarios) falling over because it didn't find anything in time. I'll keep an eye on it, if it fails again we might need to tweak the settings but I'll assist with that.

@drvinceknight
Copy link
Member

This looks good to me, thanks @dmanc 👍

@meatballs meatballs merged commit 66bf7b2 into Axelrod-Python:master Jul 30, 2017
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.

4 participants