From 4582af4c43627dbc83f01ea790e8a8f2b90d8874 Mon Sep 17 00:00:00 2001 From: Midgard Date: Tue, 26 Jan 2021 12:53:36 +0100 Subject: [PATCH] Add useless delays --- hist.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/hist.py b/hist.py index 2ac4595..59bb3bc 100755 --- a/hist.py +++ b/hist.py @@ -2,6 +2,7 @@ import sys import re +import time unknown = 0 skipped = 0 @@ -20,6 +21,7 @@ for line in sys.stdin: BLOCKS = "▁▂▃▄▅▆▇█" HEIGHT = 20 +SPEED = 400 max_val = max([*hours, unknown, skipped]) @@ -39,6 +41,9 @@ def print_block(value, row): else: print(BLOCKS[int(height_value * len(BLOCKS))], end=" ") + sys.stdout.flush() + time.sleep(2 / SPEED) + cutoff = 12 hour_indices = [*range(cutoff, 24), *range(0, cutoff)] @@ -54,6 +59,10 @@ for row in range(HEIGHT): print_block(unknown_norm, row) print() -for h in hour_indices[::2]: - print(f"{h: >2}", end=" ") -print(" skp unk") +for c in ( + "".join(f"{h: >2} " for h in hour_indices[::2]) + + " skp unk" +): + print(c, flush=True, end="") + time.sleep(1 / SPEED) +print()