-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_game.py
42 lines (37 loc) · 1.54 KB
/
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
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
from src.game import Game
import argparse
import json
def main():
parser = argparse.ArgumentParser(description="Run the game")
parser.add_argument("-b", "--blue_path", type=str, required=False)
parser.add_argument("-r", "--red_path", type=str, required=False)
parser.add_argument("-m", "--map_path", type=str, required=False)
parser.add_argument("-c", "--config_file", type=str, required=False)
parser.add_argument("--render", action="store_true", help="Whether or not to display the game while it is running")
parser.add_argument("--replay", action="store_true", help="Whether or not to store the replay")
parser.add_argument("--large", action="store_true", help="Whether or not to display the larger window")
args = parser.parse_args()
if args.config_file:
configs = json.load(open(args.config_file))
blue_path = configs["bots"][0]
red_path = configs["bots"][1]
map_path = configs["map"]
else:
if not args.blue_path or not args.red_path or not args.map_path:
raise Exception("Must provide --blue_path, --red_path, and --map_path if not using --config_file")
blue_path = args.blue_path
red_path = args.red_path
map_path = args.map_path
game = Game(
blue_path=blue_path,
red_path=red_path,
map_path=map_path,
render=args.render,
output_replay=args.replay,
large = args.large
)
winner = game.run_game()
print(f"Winner: {winner}")
if __name__ == "__main__":
main()