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 Black, K83R from Axelrod's Second #1155

Merged
merged 3 commits into from
Jan 4, 2018

Conversation

gaffney2010
Copy link
Member

Fingerprints Below

basic_fortran
basic_python
random_fortran
random_python

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 fantastic. Thanks!

I have looked through https://github.com/Axelrod-Python/TourExec/blob/master/src/strategies/k83r.f and confirm the logic is implemented correctly. 👍

@marcharper
Copy link
Member

marcharper commented Jan 3, 2018

Are we sure the memory depth is 5? It's a weird case since you need to know the round number + the last five rounds.

@drvinceknight
Copy link
Member

Are we sure the memory depth is 5? It's a weird case since you need to know the round number + the last five rounds.

This is similar to memory one strategies that all have a memory depth of 1 but that act differently on their first move to any other right?

@gaffney2010
Copy link
Member Author

You don't need to know the full round number. If you gave me just the last five moves as a list, I could check if that list is length 5 or not.

@drvinceknight
Copy link
Member

You don't need to know the full round number. If you gave me just the last five moves as a list, I could check if that list is length 5 or not.

Even better point 👍

@marcharper
Copy link
Member

I guess that's what I'm asking -- on the first move there's no history so it's sort of a special case and players must have a separate rule. Here on rounds say 4, 5, 6 you have to know the round number and then decide from one of two behaviors. So we need to know if there are at least 5 rounds of history already, so we need the size of the history and therefore all of the history. Or is the rule that we can ask "Are there at least X rounds of history?" and then take the minimum needed value of X as the memory depth?

@marcharper
Copy link
Member

Also think about the case where there's X rounds of initial play and then a behavior that depends on the last Y rounds, where X != Y.

@marcharper
Copy link
Member

marcharper commented Jan 3, 2018

Also, if the implementation were setting a bit if_round_greater_than_five then we usually call that kind of situation infinite memory...

@drvinceknight
Copy link
Member

Here on rounds say 4, 5, 6 you have to know the round number and then decide from one of two behaviors. So we need to know if there are at least 5 rounds of history already, so we need the size of the history and therefore all of the history. Or is the rule that we can ask "Are there at least X rounds of history?"

It's a good question. I think that my personal preference would be to define memory as "if you give history[-memory:] or history you get the same behaviour". I believe this isn't the first strategy that poses this question so I'd suggest we merge as is (based on the mem 1 behaviour/convention it feels right to me that this has mem depth 5). And perhaps aim to implement a test for memory on all players?

@gaffney2010
Copy link
Member Author

In this sense, Tit-For-Tat has to know the round number, since there's a special rule for when turn=1, so you have to know the turn number. But I think it's clear that TFT is memory=1; by analogy, this is memory=5. And I think it's intuitive; you're allowed to be forgetful.

@drvinceknight
Copy link
Member

drvinceknight commented Jan 3, 2018

"if you give history[-memory:] or history you get the same behaviour"

In this particular case if we're on the third turn with opponent.history=[C, C, C] then opponent.history[-5:] would also be [C, C, C], so:

+        if len(opponent.history) < 5:
+            return C

would return C.

And perhaps aim to implement a test for memory on all players?

This would potentially assist with #597 (not in finding an algorithm but at least verifying upper bounds on memory lengths).

@drvinceknight
Copy link
Member

In this particular case if we're on the third turn with opponent.history=[C, C, C] then opponent.history[-5:] would also be [C, C, C], so:

If we're on the 150th turn then len(opponent.history[-5:]) is 5 so the rest of the logic kicks in.

@drvinceknight
Copy link
Member

I've opened #1156 as a suggestion for a test (to perhaps move the discussion about the way to go over there).

@marcharper
Copy link
Member

Ok, let's discuss elsewhere. I'll merge as is.

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