-
Notifications
You must be signed in to change notification settings - Fork 264
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 Weiner, k41r from Axelrod's Second #1145
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.
Looks great, thank you @gaffney2010 👍
(FYI, I have run the tests on |
@@ -812,11 +813,13 @@ def strategy(self, opponent: Player) -> Action: | |||
if opponent.history[0] == D: | |||
number_defects -= 1 | |||
|
|||
if number_defects in [4, 7, 9]: return D | |||
if number_defects in [4, 7, 9]: |
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.
Hey @gaffney2010, it looks like you've copied this manually from #1143?
No big deal at all, I suspect you've done this to try and avoid merge conflicts going forward but for info, that's not considered best practice in terms of etiquette. A better way to do this would be to "go get" the actual git commits that make this change, there are various ways to do this (for example a command called git cherry-pick
. One of the main reasons for this is that it ends up causing problems on other people's branches (as well as potentially erasing their contributions in terms of git commit logs).
Not a big problem at all, and not suggesting you change anything (although once #1143 goes in you might end up with a merge conflict here), just letting you know 👍 :)
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.
@gaffney2010 now that #1143 has gone in there are a couple of merge conflicts. Let me know if you need a hand 👍
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.
Okay. I can see why it would be better to go get the changes directly from the commit. How can you tell that I did it manually. Did I miss something or does it show up differently?
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.
No it shows up the same but the commit that made the code on #1143 isn't in the history here so the conclusion is that you did it manually.
Not a big deal :)
I believe this is good to go now @marcharper @meatballs. 👍 |
@gaffney2010 Please resolve the merge conflict(s). |
@marcharper Sorry. I'm not seeing how to do that. [I think I saw something earlier that said fix merge conflicts, but that's not there now.] ... |
I don't believe there are any merge conflicts on this anymore and it's good to go. Let's wait for @marcharper to perhaps expand on what he meant in case he's noticed something we're both missing. 👍 |
Under "rebase and merge" (my default) github had a merge conflicts warning. However "merge pull request" worked. |
Fingerprint below.
Some notes about the translation from Fortran: The Fortran cycles through these three states, labeled by
ICASE
. I replaced the third state with a flag, calledforgive_flag
. The first two states, it goes back and forth between these as the opponent Defects; when the opponent eventually Cooperates, this strategy goes to state three (raises theforgive_flag
) if and only if it's in the second state at that point (i.e. there have been an odd number of Defects since last Cooperate). I wrote the code to replace the first two states with a parity-check on the number of Defects between Cooperates, which I calldefect_padding
. This reworking should make it a little clearer, and draws out the infinite memory depth that wasn't clear with the original code.