From c2c343697d6be4056aa6cefd341bf5b93d549729 Mon Sep 17 00:00:00 2001 From: Jiri Kalvoda Date: Thu, 22 Sep 2022 23:53:47 +0200 Subject: [PATCH] =?UTF-8?q?Strategick=C3=A1:=20Client:=20-=20je=20stdin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- klient/client.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/klient/client.py b/klient/client.py index 5122446..8982c06 100755 --- a/klient/client.py +++ b/klient/client.py @@ -41,9 +41,12 @@ def main(args: argparse.Namespace) -> None: min_round = round + 1 # if requested, dump state to file instead if args.save_state is not None: - with open(args.save_state, "w") as f: - json.dump(state, f) - return + if args.save_state == "-": + print(json.dumps(state)) + else: + with open(args.save_state, "w") as f: + json.dump(state, f) + return turn_json = run_subprocess( program, json.dumps(state), state["time_to_response"]