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

Implemented MoreTidemanAndChieruzzi, K84R from Axelrod's second #1147

Merged
merged 5 commits into from
Dec 13, 2017

Conversation

gaffney2010
Copy link
Member

FPs below.

This was similar in some ways to TidemanAndChieruzzi from the first tournament, so I tried to make my function implementation similar to the that one.

The biggest change in my refactoring was to change the way JDR was used, by calculating this as a triangle number: https://github.com/Axelrod-Python/TourExec/blob/v0.3.0/src/strategies/k84r.f#L18

basic_fortran
basic_python
random_python
random_fortran

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.

All looks good, just the tiny typo.

I'm not entirely following the logic equivalence just yet. Could you walk me through this:

The biggest change in my refactoring was to change the way JDR was used, by calculating this as a triangle number:

Thanks 👍 :)

Strategy submitted to Axelrod's second tournament by T. Nicolaus Tideman
and Paula Chieruzzi (K84R) and came in ninth in that tournament.

This strategy Cooperates if this player's socre exceeds the opponent's
Copy link
Member

Choose a reason for hiding this comment

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

score

@gaffney2010
Copy link
Member Author

@drvinceknight Sure.

https://github.com/Axelrod-Python/TourExec/blob/v0.2.0/src/strategies/k84r.f#L18 says:

IF (IS - JS - DS - 5 * JDR * (JDR - 1) / 2 .GE. 0)

I moved the term 5 * JDR * (JDR - 1) / 2 to the right-hand side of the inequality and called it score_to_beat, and rather than calculating it the same way, I calculated score_to_beat by initializing to 0 and increasing score_to_beat_inc every time that the Fortran code would have incremented JDR. Immediately after, I increase score_to_beat_inc (initially 0) by 5. I think it must be this kind of increasing scheme that motivated the formula 5 * JDR * (JDR - 1) / 2 in the first place.

@drvinceknight
Copy link
Member

AH yes! I see it now. Makes a lot of sense. 👍

self.last_fresh_start = current_round
self.fresh_start = False
return C # Second cooperation

Copy link
Member

Choose a reason for hiding this comment

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

Can you explain the name opponent_CDd? I looks like it's just checking that opponent.history[-2:] == [C, D] right? Just curious what the final d indicates.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's correct. The second d is because "CDd" is the past tense of "CD."

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