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

Implement Getzler, K35R from Axelrod's second. #1151

Merged
merged 5 commits into from
Dec 14, 2017

Conversation

gaffney2010
Copy link
Member

if not opponent.history:
return C

self.flack += 1 if opponent.history[-1]==D else 0
Copy link
Member

Choose a reason for hiding this comment

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

opponent.history[-1] == D else 0 (PEP8: spaces around the ==)


def __init__(self) -> None:
super().__init__()
self.flack = 0 # The relative untrustworthiness of opponent
Copy link
Member

Choose a reason for hiding this comment

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

The type checker is falling over on travis because it sees that self.flack is an int and then becomes a float. Change this to be self.flack = 0.0 fixes the issue (as it's initialised as a float). 👍

@drvinceknight
Copy link
Member

Logic looks good to me 👍

self.flack += 1 if opponent.history[-1] == D else 0
self.flack *= 0.5 # Defections have half-life of one round

return random_choice(1.0-self.flack)
Copy link
Member

Choose a reason for hiding this comment

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

spaces around -

@drvinceknight
Copy link
Member

Thanks @gaffney2010 :)

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