|
1 | 1 | from axelrod_fortran.strategies import characteristics, all_strategies
|
2 | 2 | from axelrod_fortran import Player
|
3 | 3 | from axelrod import (Alternator, Cooperator, Defector,
|
4 |
| - Match, Game, basic_strategies) |
| 4 | + Match, Game, basic_strategies, seed) |
5 | 5 | from axelrod.action import Action
|
6 | 6 | from ctypes import c_int, c_float, POINTER
|
7 | 7 |
|
@@ -111,3 +111,24 @@ def test_deterministic_strategies():
|
111 | 111 | interactions = match.play()
|
112 | 112 | for _ in range(2): # Repeat 3 matches
|
113 | 113 | assert interactions == match.play(), player
|
| 114 | + |
| 115 | + |
| 116 | +def test_implemented_strategies(): |
| 117 | + """ |
| 118 | + Test that the deterministic strategies that are implemented in Axelrod |
| 119 | + give the same outcomes. |
| 120 | + """ |
| 121 | + known_failures = ["k57r", "k59r", "k86r"] |
| 122 | + for strategy, dictionary in characteristics.items(): |
| 123 | + axelrod_class = dictionary["axelrod-python_class"] |
| 124 | + player = Player(strategy) |
| 125 | + if (axelrod_class is not None and |
| 126 | + strategy not in known_failures and |
| 127 | + player.classifier["stochastic"] is False): |
| 128 | + axl_player = axelrod_class() |
| 129 | + for opponent_strategy in basic_strategies: |
| 130 | + opponent = opponent_strategy() |
| 131 | + match = Match((player, opponent)) |
| 132 | + interactions = match.play() |
| 133 | + axl_match = Match((axl_player, opponent)) |
| 134 | + assert interactions == axl_match.play(), (player, opponent) |
0 commit comments