From 729455edf7fe92ba46ba2ea274bc3b5f4879b71b Mon Sep 17 00:00:00 2001 From: Aineopintojen-harjoitustyo-Algoritmit-j Date: Sat, 3 Feb 2024 15:05:55 +0200 Subject: Adding tests to whole app. --- __main__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to '__main__.py') diff --git a/__main__.py b/__main__.py index 6dad3f8..c98633b 100644 --- a/__main__.py +++ b/__main__.py @@ -27,13 +27,19 @@ if args.file is None: del app else: run_count = 0 - print(f"Pelataan miinaharavat tiedostosta {args.file}") with open(args.file, "r", encoding="utf-8") as bfile: board = [] while True: line = bfile.readline() if not line or (line[0]!='.' and line[0]!='@'): if board: + win_percent = (100*win_count/run_count) if run_count else 0 + print(end= + f" \rAjo ...{args.file[-18:]:} ({run_count+1}): " + f"({win_percent:.1f}%).." + ) + if not args.quiet: + print() args.board = board app = App(args) win_count += app.run() -- cgit v1.2.3