-
Notifications
You must be signed in to change notification settings - Fork 263
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
Three new ZD strategies #1097
Three new ZD strategies #1097
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.
A typo and a minor request, also zero_determinant
needs to be added to docs/reference/all_strategies
:)
|
||
class ZDExtort3(LRPlayer): | ||
""" | ||
An extortionate strategy from Press and Dyson's paper an extortion factor |
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.
with an extortion
} | ||
|
||
def test_four_vector(self): | ||
expected_dictionary = {(C, C): 0.64, (C, D): 0.18, (D, C): 0.28, |
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.
Can we write these as fractions here? (Just to avoid floating point errors)
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 took them from the reference like that. Can change if you want...
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.
Only to avoid the numerical manipulation carried out by the strategy to throw out numerical floating point errors at some point? (if it never fails then I'm completely fine with them being numeric, just trying to avoid a trivial fix in the future)
>>> import sympy as sym
>>> sym.nsimplify(.64), sym.nsimplify(0.18), sym.nsimplify(0.28)
(16/25, 9/50, 7/25)
|
||
def reset(self): | ||
super().reset() | ||
self.retaliate_count = 0 |
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.
This not tripping a test means we can probably improve the test...
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.
Hypothesis caught it
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.
Nice 👍
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've just written another one. Pushing it now :)
We were only playing against Random, @marcharper found and fixed a bug via hypothesis on it here: #1097 This catches the bug too: Axelrod(pass-match-attributes) ✗: python -m unittest axelrod.tests.strategies.test_titfortat ...............................................................................F................................................................ ====================================================================== FAIL: test_reset_history_and_attributes (axelrod.tests.strategies.test_titfortat.TestNTitsForMTats) Make sure resetting works correctly. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/vince/src/Axelrod/axelrod/tests/strategies/test_player.py", line 411, in test_reset_history_and_attributes self.assertEqual(player, clone) AssertionError: N Tit(s) For M Tat(s): 3, 2 != N Tit(s) For M Tat(s): 3, 2
We were only playing against Random, @marcharper found and fixed a bug via hypothesis on it here: #1097 This catches the bug too: Axelrod(pass-match-attributes) ✗: python -m unittest axelrod.tests.strategies.test_titfortat ...............................................................................F................................................................ ====================================================================== FAIL: test_reset_history_and_attributes (axelrod.tests.strategies.test_titfortat.TestNTitsForMTats) Make sure resetting works correctly. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/vince/src/Axelrod/axelrod/tests/strategies/test_player.py", line 411, in test_reset_history_and_attributes self.assertEqual(player, clone) AssertionError: N Tit(s) For M Tat(s): 3, 2 != N Tit(s) For M Tat(s): 3, 2
Assuming appveyor is happy. 👍 |
We were only playing against Random, @marcharper found and fixed a bug via hypothesis on it here: #1097 This catches the bug too: Axelrod(pass-match-attributes) ✗: python -m unittest axelrod.tests.strategies.test_titfortat ...............................................................................F................................................................ ====================================================================== FAIL: test_reset_history_and_attributes (axelrod.tests.strategies.test_titfortat.TestNTitsForMTats) Make sure resetting works correctly. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/vince/src/Axelrod/axelrod/tests/strategies/test_player.py", line 411, in test_reset_history_and_attributes self.assertEqual(player, clone) AssertionError: N Tit(s) For M Tat(s): 3, 2 != N Tit(s) For M Tat(s): 3, 2
We were only playing against Random, @marcharper found and fixed a bug via hypothesis on it here: #1097 This catches the bug too: Axelrod(pass-match-attributes) ✗: python -m unittest axelrod.tests.strategies.test_titfortat ...............................................................................F................................................................ ====================================================================== FAIL: test_reset_history_and_attributes (axelrod.tests.strategies.test_titfortat.TestNTitsForMTats) Make sure resetting works correctly. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/vince/src/Axelrod/axelrod/tests/strategies/test_player.py", line 411, in test_reset_history_and_attributes self.assertEqual(player, clone) AssertionError: N Tit(s) For M Tat(s): 3, 2 != N Tit(s) For M Tat(s): 3, 2
Also: