@@ -56,7 +56,7 @@ def __init__(self, players, match_generator=RoundRobinMatches,
56
56
self ._logger = logging .getLogger (__name__ )
57
57
58
58
def play (self , build_results = True , filename = None ,
59
- processes = None , progress_bar = True ):
59
+ processes = None , progress_bar = True , keep_interactions = False ):
60
60
"""
61
61
Plays the tournament and passes the results to the ResultSet class
62
62
@@ -70,6 +70,9 @@ def play(self, build_results=True, filename=None,
70
70
The number of processes to be used for parallel processing
71
71
progress_bar : bool
72
72
Whether or not to create a progress bar which will be updated
73
+ keep_interactions : bool
74
+ Whether or not to save the interactions to memory. Only relevant
75
+ when writing to file.
73
76
74
77
Returns
75
78
-------
@@ -106,24 +109,23 @@ def play(self, build_results=True, filename=None,
106
109
self .outputfile .close ()
107
110
108
111
if build_results :
109
- return self ._build_result_set (progress_bar = progress_bar )
112
+ return self ._build_result_set (progress_bar = progress_bar ,
113
+ keep_interactions = keep_interactions )
110
114
111
- def _build_result_set (self , progress_bar = True ):
115
+ def _build_result_set (self , progress_bar = True , keep_interactions = False ):
112
116
"""
113
117
Build the result set (used by the play method)
114
118
115
119
Returns
116
120
-------
117
121
axelrod.BigResultSet
118
122
"""
119
- # TODO Change ResultSet -> ResultSetFromDict and then have ResultSet
120
- # which recognises the inputs (if a filename is provided is brings in
121
- # ResultSetFromFile, if not it brings in ResultSetFromDict).
122
123
if self .filename is not None :
123
124
result_set = ResultSetFromFile (filename = self .filename ,
124
125
progress_bar = progress_bar ,
125
126
num_interactions = self .num_interactions ,
126
127
nrepetitions = self .repetitions ,
128
+ keep_interactions = keep_interactions ,
127
129
players = [str (p ) for p in self .players ],
128
130
game = self .game )
129
131
self .outputfile .close ()
0 commit comments