Skip to content

Commit e3da817

Browse files
drvinceknightmarcharper
authored andcommitted
Move swapping of states order to outer context
Note I did not use `reversed()`, this doesn't return a tuple, I also didn't use `.reverse()` this only works on lists.
1 parent b0eb05d commit e3da817

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

axelrod/tournament.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,11 @@ def _write_interactions_to_file(self, results, writer):
252252
row.append(cooperations[index])
253253

254254
states = [(C, C), (C, D), (D, C), (D, D)]
255+
if index == 1:
256+
states = [s[::-1] for s in states]
255257
for state in states:
256-
if index == 1:
257-
state = state[::-1]
258258
row.append(state_distribution[state])
259259
for state in states:
260-
if index == 1:
261-
state = state[::-1]
262260
row.append(state_to_action_distributions[index][(state, C)])
263261
row.append(state_to_action_distributions[index][(state, D)])
264262

0 commit comments

Comments
 (0)