Cleanpu
This commit is contained in:
parent
12214b7097
commit
fb18e01440
31
\
31
\
|
@ -1,31 +0,0 @@
|
||||||
#!/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()
|
|
4
game.py
4
game.py
|
@ -160,7 +160,5 @@ def main() -> int:
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
score: int = main()
|
save_score(main())
|
||||||
with open('./.score', 'w') as score_file:
|
|
||||||
score_file.write(str(score))
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
3
utils.py
3
utils.py
|
@ -34,6 +34,9 @@ class FingerType(Enum):
|
||||||
PINKY_KNUCKLE_2 = 19
|
PINKY_KNUCKLE_2 = 19
|
||||||
PINKY_TIP = 20
|
PINKY_TIP = 20
|
||||||
|
|
||||||
|
def save_score(score: int) -> None:
|
||||||
|
with open('./.score', 'w') as score_file:
|
||||||
|
score_file.write(str(score))
|
||||||
|
|
||||||
def collect_sfx() -> None:
|
def collect_sfx() -> None:
|
||||||
Popen(['paplay', './assets/sfx/collect.mp3'])
|
Popen(['paplay', './assets/sfx/collect.mp3'])
|
||||||
|
|
Loading…
Reference in New Issue