@@ -56,42 +56,41 @@ def __init__(
56
56
Random seed for reproducibility
57
57
"""
58
58
59
- defaults = {
60
- (True , True ): (DEFAULT_TURNS , 0 ),
61
- (True , False ): (float ("inf" ), prob_end ),
62
- (False , True ): (turns , 0 ),
63
- (False , False ): (turns , prob_end ),
64
- }
65
- self .turns , self .prob_end = defaults [(turns is None , prob_end is None )]
59
+
60
+ self .turns , self .prob_end = turns , prob_end
61
+ if prob_end is None :
62
+ self .prob_end = 0
63
+ if turns is None :
64
+ self .turns = float ("inf" )
65
+ if turns is None and prob_end is None :
66
+ self .turns = DEFAULT_TURNS
66
67
67
68
self .result = []
68
69
self .noise = noise
69
70
70
- self .set_seed (seed )
71
-
71
+ self .game = game
72
72
if game is None :
73
73
self .game = Game ()
74
- else :
75
- self .game = game
76
74
75
+ self ._cache = deterministic_cache
77
76
if deterministic_cache is None :
78
77
self ._cache = DeterministicCache ()
79
- else :
80
- self ._cache = deterministic_cache
81
78
79
+ self .match_attributes = match_attributes
82
80
if match_attributes is None :
81
+ # known_turns = inf if both prob_end and turns are None, else turns
83
82
known_turns = self .turns if prob_end is None else float ("inf" )
84
83
self .match_attributes = {
85
84
"length" : known_turns ,
86
85
"game" : self .game ,
87
86
"noise" : self .noise ,
88
87
}
89
- else :
90
- self .match_attributes = match_attributes
91
88
92
89
self .players = list (players )
93
90
self .reset = reset
94
91
92
+ self .set_seed (seed )
93
+
95
94
def set_seed (self , seed ):
96
95
"""Sets a random seed for the Match, for reproducibility. Initializes
97
96
a match-wide RNG instance which is used to propagate seeds to the Players
0 commit comments