-
Notifications
You must be signed in to change notification settings - Fork 2
/
simulator.py
28 lines (24 loc) · 1.04 KB
/
simulator.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
import misc
import merger
import cleaner
import argparse
import subprocess
class Simulator:
tempdir = ".temp"
args = []
def __init__(self, args):
self.args = args
cleaner.Cleaner(self.args, self.tempdir).clean()
merger.Merger(self.args, self.tempdir).merge()
def start(self):
print("Starting...")
subprocess.run(["node", self.tempdir + "/" + "script.js", self.tempdir + "/test.txt", str(self.args.balance), str(self.args.crashes).lower()])
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("script", help="script to test", type=misc.isFileExist)
parser.add_argument("testfile", help="file with games", type=misc.isFileExist)
parser.add_argument("-l", "--logs", help="view script logs", action='store_true')
parser.add_argument("-c", "--crashes", help="display 25 biggest crashes", action='store_true')
parser.add_argument("-b", "--balance", help="starting balance", type=int, default=1000000000)
Simulator(parser.parse_args()).start()
exit(0)