|
7 | 7 | inspect_strategy, |
8 | 8 | look_ahead, |
9 | 9 | recursive_thue_morse, |
10 | | - simulate_match, |
11 | 10 | thue_morse_generator, |
12 | 11 | ) |
13 | 12 | from hypothesis import given, settings |
@@ -81,54 +80,6 @@ def test_strategies_without_countermeasures_return_their_strategy(self): |
81 | 80 | self.assertEqual(inspect_strategy(inspector=inspector, opponent=tft), D) |
82 | 81 | self.assertEqual(tft.strategy(inspector), D) |
83 | 82 |
|
84 | | - def test_strategies_with_countermeasures_return_their_countermeasures(self): |
85 | | - d_geller = axl.GellerDefector() |
86 | | - inspector = axl.Cooperator() |
87 | | - match = axl.Match((d_geller, inspector), turns=1) |
88 | | - match.play() |
89 | | - self.assertEqual( |
90 | | - inspect_strategy(inspector=inspector, opponent=d_geller), D |
91 | | - ) |
92 | | - self.assertEqual(d_geller.strategy(inspector), C) |
93 | | - |
94 | | - |
95 | | -class TestSimulateMatch(unittest.TestCase): |
96 | | - def test_tft_reacts_to_cooperation(self): |
97 | | - tft = axl.TitForTat() |
98 | | - inspector = axl.Alternator() |
99 | | - |
100 | | - simulate_match(inspector, tft, C, 5) |
101 | | - self.assertEqual(inspector.history, [C, C, C, C, C]) |
102 | | - self.assertEqual(tft.history, [C, C, C, C, C]) |
103 | | - |
104 | | - def test_tft_reacts_to_defection(self): |
105 | | - tft = axl.TitForTat() |
106 | | - inspector = axl.Alternator() |
107 | | - |
108 | | - simulate_match(inspector, tft, D, 5) |
109 | | - self.assertEqual(inspector.history, [D, D, D, D, D]) |
110 | | - self.assertEqual(tft.history, [C, D, D, D, D]) |
111 | | - |
112 | | - |
113 | | -class TestLookAhead(unittest.TestCase): |
114 | | - def setUp(self): |
115 | | - self.inspector = axl.Player() |
116 | | - self.game = axl.Game() |
117 | | - |
118 | | - def test_cooperator(self): |
119 | | - tft = axl.Cooperator() |
120 | | - # It always makes sense to defect here. |
121 | | - self.assertEqual(look_ahead(self.inspector, tft, self.game, 1), D) |
122 | | - self.assertEqual(look_ahead(self.inspector, tft, self.game, 2), D) |
123 | | - self.assertEqual(look_ahead(self.inspector, tft, self.game, 5), D) |
124 | | - |
125 | | - def test_tit_for_tat(self): |
126 | | - tft = axl.TitForTat() |
127 | | - # Cooperation should be chosen if we look ahead further than one move. |
128 | | - self.assertEqual(look_ahead(self.inspector, tft, self.game, 1), D) |
129 | | - self.assertEqual(look_ahead(self.inspector, tft, self.game, 2), C) |
130 | | - self.assertEqual(look_ahead(self.inspector, tft, self.game, 5), C) |
131 | | - |
132 | 83 |
|
133 | 84 | class TestRecursiveThueMorse(unittest.TestCase): |
134 | 85 | def test_initial_values(self): |
|
0 commit comments