-
Notifications
You must be signed in to change notification settings - Fork 282
Add Alexei strategy #997
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
Add Alexei strategy #997
Changes from 26 commits
0b71b6e
fa70b52
0be3624
4c471b9
640712e
de8f570
c977452
a0b9f63
b70c5c2
693ea45
e83de3a
1aa8b4f
fd1fa66
fd55bf6
ea8bb11
d3207d6
5c1d688
62bb722
7d1a8cf
f8db68d
d789c38
b10c09d
bb55e6c
e3fe33b
f0f863a
02a5801
54c54fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -563,3 +563,56 @@ def test_strategy(self): | |
| actions = [(C, C), (C, C), (C, D), (C, D), (D, C), (D, D), (D, D), | ||
| (D, C), (D, C), (C, D), (C, D)] | ||
| self.versus_test(opponent, expected_actions=actions) | ||
|
|
||
| class TestAlexei(TestPlayer): | ||
| """ | ||
| Tests for the Alexei strategy | ||
| """ | ||
|
|
||
| name = "Alexei: ('D',)" | ||
| player = axelrod.Alexei | ||
| expected_classifier = { | ||
| 'memory_depth': float('inf'), | ||
| 'stochastic': False, | ||
| 'makes_use_of': {'length'}, | ||
| 'inspects_source': False, | ||
| 'manipulates_source': False, | ||
| 'manipulates_state': False | ||
| } | ||
|
|
||
| def test_strategy(self): | ||
| self.first_play_test(C) | ||
| self.second_play_test(rCC=C, rCD=D, rDC=C, rDD=D) | ||
|
|
||
| actions = [(C, C), (C, D), (D, C), (C, D), (D, C)] | ||
| self.versus_test(axelrod.Alternator(), expected_actions=actions) | ||
|
|
||
| actions = [(C, C), (C, C), (C, C), (C, C), (D, C)] | ||
| self.versus_test(axelrod.Cooperator(), expected_actions=actions) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are getting a failure against Cooperator. |
||
|
|
||
| actions = [(C, D), (D, D), (D, D), (D, D), (D, D)] | ||
| self.versus_test(axelrod.Defector(), expected_actions=actions) | ||
|
|
||
| actions = [(C, C), (C, D), (D, C), (C, D), (D, C), (C, D)] | ||
| self.versus_test(axelrod.Alternator(), expected_actions=actions, | ||
| match_attributes={"length": -1}) | ||
|
|
||
| actions = [(C, C), (C, D), (D, C), (C, D), (D, C), (D, D)] | ||
| self.versus_test(axelrod.Alternator(), expected_actions=actions) | ||
|
|
||
|
|
||
| actions = [(C, D), (D, D), (D, C), (C, C), (D, D)] | ||
|
||
| self.versus_test(axelrod.Random(), expected_actions=actions, | ||
| seed=0) | ||
|
|
||
| actions = [(C, C), (C, D), (D, D), (D, C)] | ||
|
||
| self.versus_test(axelrod.Random(), expected_actions=actions, | ||
| seed=1) | ||
|
|
||
| opponent = axelrod.MockPlayer(actions=[C, D]) | ||
|
||
| actions = [(C, C), (C, D), (D, C), (D, D)] | ||
| self.versus_test(opponent, expected_actions=actions) | ||
|
|
||
| opponent = axelrod.MockPlayer(actions=[C, C, D, D, C, D]) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As long as coverage remains the same, I think we can remove this test. |
||
| actions = [(C, C), (C, C), (C, D), (D, D), (D, C), (D, D)] | ||
| self.versus_test(opponent, expected_actions=actions) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ documentation. | |
| .. [Frean1994] Frean, Marcus R. “The Prisoner's Dilemma without Synchrony.” Proceedings: Biological Sciences, vol. 257, no. 1348, 1994, pp. 75–79. www.jstor.org/stable/50253. | ||
| .. [Hilde2013] Hilbe, C., Nowak, M.A. and Traulsen, A. (2013). Adaptive dynamics of extortion and compliance, PLoS ONE, 8(11), p. e77886. doi: 10.1371/journal.pone.0077886. | ||
| .. [Kraines1989] Kraines, D. & Kraines, V. Theor Decis (1989) 26: 47. doi:10.1007/BF00134056 | ||
| .. [LessWrong2011] Zoo of Strategies (2011) LessWrong. Available at: http://lesswrong.com/lw/7f2/prisoners_dilemma_tournament_results/ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All on one line please. I think this doesn't play properly with sphinx otherwise.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I have written in one line. Unless I am misunderstanding something.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have indeed. I'll review properly when I get a moment. |
||
| .. [Li2009] Li, J. & Kendall, G. (2009). A Strategy with Novel Evolutionary Features for the Iterated Prisoner’s Dilemma. Evolutionary Computation 17(2): 257–274. | ||
| .. [Li2011] Li, J., Hingston, P., Member, S., & Kendall, G. (2011). Engineering Design of Strategies for Winning Iterated Prisoner ’ s Dilemma Competitions, 3(4), 348–360. | ||
| .. [Li2014] Li, J. and Kendall, G. (2016). The Effect of Memory Size on the Evolutionary Stability of Strategies in Iterated Prisoner's Dilemma. IEEE Transactions on Evolutionary Computation, 18(6) 819-826 | ||
|
|
||
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.
We can remove this test because you moved it.