File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,9 @@ def simulatePrisoners():
177177 startSim = checkpoint .get ("last_simulation" ) + 1
178178 rng = random .Random (config ["CONFIG" ].get ("seed" , None ))
179179 rng .setstate (checkpoint .get ("rng_state" ))
180+ if startSim >= config ["CONFIG" ]["num_simulations" ]:
181+ print ("All simulations have already been completed." )
182+ return
180183 print (f"Resuming from simulation { startSim } ." )
181184 else :
182185 startSim = 0
@@ -185,9 +188,6 @@ def simulatePrisoners():
185188 checkpoint = {"last_simulation" : - 1 , "rng_state" : rng .getstate ()}
186189 print ("Starting new simulations." )
187190
188- if startSim >= config ["CONFIG" ]["num_simulations" ]:
189- print ("All simulations have already been completed." )
190- return
191191
192192 for sim in range (startSim , config ["CONFIG" ]["num_simulations" ]):
193193 prisoners = {i : [0 , False ] for i in range (config ["CONFIG" ]["num_prisoners" ])}
@@ -216,6 +216,7 @@ def simulatePrisoners():
216216
217217if __name__ == "__main__" :
218218 base_dir = os .path .dirname (os .path .abspath (__file__ ))
219+ config = None
219220 while True :
220221 print (f"\n Choose an option:" )
221222 print (f"1. Create new simulation" )
You can’t perform that action at this time.
0 commit comments