PARALLELISERAD LAUNCHER!!!
This commit is contained in:
parent
d3a4849fd1
commit
cf977331e3
27
launcher.py
27
launcher.py
@ -1,8 +1,23 @@
|
||||
import main
|
||||
number_of_launches = 4
|
||||
result_list = []
|
||||
for i in range(number_of_launches):
|
||||
result_list.append(main.main())
|
||||
for result in result_list:
|
||||
import time
|
||||
from multiprocessing import Pool
|
||||
import multiprocessing
|
||||
|
||||
proc_running = 4 # MAX 4!!!
|
||||
|
||||
|
||||
def run_main(n):
|
||||
result = main.main()
|
||||
return result
|
||||
|
||||
|
||||
def launch(list):
|
||||
for result in list:
|
||||
print("Game " + result[0] + " had a score of: " + str(result[1]))
|
||||
input("Press Enter to exit")
|
||||
input("Press Enter to exit")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
with Pool(proc_running) as p:
|
||||
results = p.map(run_main, range(proc_running))
|
||||
launch(results)
|
||||
|
Reference in New Issue
Block a user