Implemented Yamachi, k64r from Axelrod's Second. #1163
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fingerprints below.
The refactoring is somewhat straight-forward with the exception of /~https://github.com/Axelrod-Python/TourExec/blob/v0.3.0/src/strategies/k64r.f#L30. Here, I refactored as
P = |E-F|, but E+F = M-1, so that P = |2E+1-M|. Then 10*P < M iff P/(2M) < 0.05. Equivalently, |(E+0.5)/M - 0.5| < 0.05. I called (E+0.5)/M as
portion_defect
and bounded by 0.45 and 0.55.Also a little different is I update history before deciding on a move, so to emulate the Fortan (which does after), I wait until the third turn to start (instead of the second) and look back one extra turn.
I think count_them_us_them was intended to be indexed by them_three_ago, us_two_ago, them_last, so that it predicts the opponent's next turn. It kind of predicts the opponents last move instead... [If you look at lines 22 and 23 of the Fortan, it's moving A(X,Y) based on J, but J can't be in response to Y, our own last move.]