-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_game.py
34 lines (28 loc) · 877 Bytes
/
run_game.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
import sys
import multiprocessing
import time
def run_bank():
os.system(f"{sys.executable} bank.py")
def run_player1():
time.sleep(3)
os.system(f"{sys.executable} player.py")
def run_player2():
time.sleep(3)
os.system(f"{sys.executable} player.py")
if __name__ == "__main__":
bank_process = multiprocessing.Process(target=run_bank)
player1_process = multiprocessing.Process(target=run_player1)
player2_process = multiprocessing.Process(target=run_player2)
try:
bank_process.start()
player1_process.start()
player2_process.start()
bank_process.join()
player1_process.join()
player2_process.join()
finally:
# Sicherstellen, dass alle Prozesse beendet werden
bank_process.terminate()
player1_process.terminate()
player2_process.terminate()