-
Notifications
You must be signed in to change notification settings - Fork 268
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 White strategy, k72r from Axelrod's Second #1154
Conversation
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.
More of a question then a request but just want to be sure (could indicate an incorrect ranking in axelrod_fortran
or an off by 1 error).
Note that changing /~https://github.com/Axelrod-Python/axelrod-fortran/blob/master/src/axelrod_fortran/strategies.py#L216 to be False
so that a value of R
of 0 is passed to the Fortran code changes the behaviour of the fortran function.
axelrod/strategies/axelrod_second.py
Outdated
class White(Player): | ||
""" | ||
Strategy submitted to Axelrod's second tournament by Edward C Whtie (K72R) | ||
and came in twelfth in that tournament. |
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.
Looking at /~https://github.com/Axelrod-Python/axelrod-fortran/blob/master/src/axelrod_fortran/strategies.py#L214 it looks like it ranked 13th?
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.
It should say thirteenth, and actually the last few would be off. I'll fix them.
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.
I got thrown off at Kluepfel, which had already been implemented since I've started doing these in order.
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.
changes the behaviour of the fortran function
Changes how? /~https://github.com/Axelrod-Python/TourExec/blob/v0.3.0/src/strategies/k72r.f#L12 must be rounding down the right-hand side, otherwise the 100% cooperation in the first ten moves (in the fingerprints) wouldn't make sense.
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.
If you pass a 0 (which is what we do when marking a function as stochastic: False
) then the function seems to always defect.
It's not an issue, just noting it. I think that essentially that stochastic:
key is whether or not the original Fortran code used the random number anywhere, even if as you've noticed here, it ended up not being relevant.
Conflicts: axelrod/strategies/axelrod_second.py
Thanks! (my bad for missing those rankings in the docstrings previously. 👍) |
Nudge @marcharper and @meatballs (in case you've missed this): I have checked the logic and this looks good to go 👍 |
axelrod/strategies/axelrod_second.py
Outdated
|
||
class White(Player): | ||
""" | ||
Strategy submitted to Axelrod's second tournament by Edward C Whtie (K72R) |
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.
Whtie -> White
axelrod/strategies/axelrod_second.py
Outdated
Strategy submitted to Axelrod's second tournament by Edward C Whtie (K72R) | ||
and came in thirteenth in that tournament. | ||
|
||
If the opponent Cooperated last turn or in the first ten turns, then |
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.
"""
* If the opponent cooperated last turn or in the first ten turns, then
cooperate.
* Otherwise defect if and only if:
floor(log(turn)) * opponent.defections >= turn
"""
Looks fine to me, please fix the typo in the name at least. |
Made those changes. |
Great. Thanks 👍 |
Fingerprints below.
Notes on refactor from /~https://github.com/Axelrod-Python/TourExec/blob/v0.3.0/src/strategies/k72r.f :
N, M, and JCOUNT are all integers, so everything gets rounded. So the probability statement (line 12) actually only ever gets run with 0% or 100% (evidenced by the basic-strategy fingerprints). And actually unless the if-statement in line 11 gets run, then the probability statement always Cooperates, since JCOUNT can be at most M-1.