From 12214b709737b391056db2c5f904589e4bc3bb2d Mon Sep 17 00:00:00 2001 From: cubernetes Date: Fri, 11 Aug 2023 03:33:54 +0200 Subject: [PATCH] Highscore tmuxgit diff --staged! --- "\\" | 31 +++++++++++++++++++++++++++++++ master.py | 11 +++++++++++ 2 files changed, 42 insertions(+) create mode 100644 "\\" diff --git "a/\\" "b/\\" new file mode 100644 index 0000000..9915f27 --- /dev/null +++ "b/\\" @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 + +from time import sleep +from typing import NoReturn + +from utils import * + +def start_game() -> None: + proc = Popen(['./start_game.sh']) + proc.communicate() + +def show_highscore() -> None: + Popen([ + 'tmux', + 'display-popup', + '-E', + 'watch', + '-tcn0', + r"""sh -c 'for _ in $(seq $(($(tput lines) / 3))); do printf "\n"; done; figlet -w $(tput cols) -c $(cat "/home/tosuman/42/hackthelobby/.score")'""", + ]) + +def main() -> NoReturn: + show_matrix() + show_highscore() + while True: + if found_hands(): + start_game() + sleep(1) + +if __name__ == '__main__': + main() diff --git a/master.py b/master.py index 663a867..757fd79 100755 --- a/master.py +++ b/master.py @@ -9,8 +9,19 @@ def start_game() -> None: proc = Popen(['./start_game.sh']) proc.communicate() +def show_highscore() -> None: + Popen([ + 'tmux', + 'display-popup', + '-E', + 'watch', + '-tcn.5', + r"""sh -c 'for _ in $(seq $(($(tput lines) / 3))); do printf "\n\033[31m"; done; figlet -w $(tput cols) -c $(cat "/home/tosuman/42/hackthelobby/.score")'""", + ]) + def main() -> NoReturn: show_matrix() + show_highscore() while True: if found_hands(): start_game()