-
Notifications
You must be signed in to change notification settings - Fork 1
/
ti4_planet_selection.py
executable file
·27 lines (23 loc) · 1.19 KB
/
ti4_planet_selection.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
#!/usr/bin/env python
import argparse
from _ti4_planet_selection import ti4_planet_selection, config_options
# Main function
def main():
parser = argparse.ArgumentParser(description="Allocate tiles for TI4")
options = config_options()
num_players_options = sorted(list(set([option[0] for option in options])))
expansion_options = sorted(list(set([option[1] for option in options])))
style_options = sorted(list(set([option[2] for option in options])))
parser.add_argument("num_players", type=int, choices=num_players_options)
parser.add_argument("-e", "--expansion", choices=expansion_options, default="base")
parser.add_argument("-s", "--style", choices=style_options, default="default")
parser.add_argument("-l", "--legendary", type=int, choices=[0, 1, 2], default=0)
args = parser.parse_args()
formatter = "Text"
option = (args.num_players, args.expansion, args.style, args.legendary)
if option in options:
print(ti4_planet_selection(args.num_players, args.expansion, args.style, args.legendary, formatter))
else:
raise RuntimeError("Invalid configuration, valid choices are:\n{}".format(options))
if __name__ == "__main__":
main()