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