diff --git a/game.py b/game.py index f2d84ef..00efd27 100755 --- a/game.py +++ b/game.py @@ -2,11 +2,9 @@ import sys import random -import psutil import numpy as np import cv2 -from cv2 import VideoCapture from utils import * @@ -103,9 +101,8 @@ def show_frame(frame: np.ndarray, to_stdout: bool=False) -> None: def main() -> int: music = start_game_sfx() - music_p = psutil.Process(pid=music.pid) - capture: VideoCapture = cv2.VideoCapture(0) + capture: cv2.VideoCapture = cv2.VideoCapture(0) hands: mp.solutions.hands.Hands = mp_hands.Hands(max_num_hands=1) collected_42: bool = True noise_42img: int = 5 @@ -157,7 +154,6 @@ def main() -> int: music.kill() lost_sfx() return score - for positions in finger_positions: index_knuckle_1_pos: tuple[int, int] = (-1, -1) @@ -182,9 +178,7 @@ def main() -> int: i = 0 score += 42 if score == 4200 / 4: # that's 25 collects - music_p.suspend() initiate_rick() - music_p.resume() timer = 60 + (timer - 60) * .9 collect_sfx() show_frame(frame, to_stdout=(not sys.stdout.isatty())) @@ -192,4 +186,3 @@ def main() -> int: if __name__ == '__main__': save_score(main()) - sys.exit(0) diff --git a/master.py b/master.py index d74d531..24f3cf9 100755 --- a/master.py +++ b/master.py @@ -23,12 +23,12 @@ def show_highscore() -> None: '-E', 'watch', '-tcn.6', - r"""bash -c - 'for _ in $(seq $(($(tput lines) / 3 - 1))); - do printf "\n\033[31m"; - done; - printf "%$(($(tput cols) / 2 + 5))s\n" "Highscore:"; - figlet -w $(tput cols) -c $(cat "/home/tosuman/42/hackthelobby/.score"); + r"""bash -c \ + 'for _ in $(seq $(($(tput lines) / 3 - 1)));\ + do printf "\n\033[31m";\ + done;\ + printf "%$(($(tput cols) / 2 + 5))s\n" "Highscore:";\ + figlet -w $(tput cols) -c $(cat "/home/tosuman/42/hackthelobby/.score");\ printf "\n\033[3$((RANDOM % 7 + 1))m%$(($(tput cols) / 2 + 4 + RANDOM % 8))s\n" "Show your hands!"'""", ]) diff --git a/requirements.txt b/requirements.txt index 26044ad..d5104ec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,6 @@ opencv-python==4.8.0.76 packaging==23.1 Pillow==10.0.0 protobuf==3.20.3 -psutil==5.9.5 pycparser==2.21 pyparsing==3.0.9 python-dateutil==2.8.2