PARALLELISERAD LAUNCHER!!!

This commit is contained in:
Thefeli73 2020-10-07 03:34:42 +02:00
parent d3a4849fd1
commit cf977331e3

View File

@ -1,8 +1,23 @@
import main import main
number_of_launches = 4 import time
result_list = [] from multiprocessing import Pool
for i in range(number_of_launches): import multiprocessing
result_list.append(main.main())
for result in result_list: 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])) 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)