-
Notifications
You must be signed in to change notification settings - Fork 2
/
cli.py
36 lines (27 loc) · 921 Bytes
/
cli.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
from pylixir.application.game import Client
from pylixir.interface.cli import get_client
import fire
def tui(client: Client):
print(client.view())
while True:
command = input().strip()
if command == "r":
client.reroll()
else:
try:
sage_index, effect_index = map(int, command.split())
except ValueError:
print("Wrong input. Try again as {int, int} or r for Reroll")
continue
if sage_index > 2 or effect_index > 4:
print("Sage index may < 3 and Effect index may < 5")
continue
client.pick(sage_index, effect_index)
print(client.view())
if client.is_done():
break
def run(seed: int = 42):
client = get_client(seed, show_previous_board=True)
tui(client)
if __name__ == "__main__":
fire.Fire(run)