-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMain.py
64 lines (53 loc) · 1.67 KB
/
Main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import keyboard as kb
from time import sleep
from Tablero import Tablero
import os
if os.name == "posix":
var = "clear"
elif os.name == "ce" or os.name == "nt" or os.name == "dos":
var = "cls"
def detectar_tecla() -> str:
tecla_str : str = ""
while(True):
if kb.is_pressed("up"):
tecla_str = "up"
break
elif kb.is_pressed("down"):
tecla_str = "down"
break
elif kb.is_pressed("right"):
tecla_str = "right"
break
elif kb.is_pressed("left"):
tecla_str = "left"
break
elif kb.is_pressed("enter"):
tecla_str = "enter"
break
return tecla_str
def main():
#Instanciamos la clase Tablero
tablero = Tablero()
tablero.crearTablero(6)
#Limpiamos la pantalla
os.system(var)
tablero.imprimirCasillas()
print(f"Posición del cursor: {tablero.get_cursor()}")
print("\n\nUsa las flechas para moverte en el tablero")
print("Presiona enter para desbloquear una casilla")
print("El juego termina al encontrar todos los pares de emojis:)")
while(tablero.get_puntuacion() <= 17):
sleep(.15)
tablero.rastrear_teclas(detectar_tecla())
os.system(var)
tablero.imprimirCasillas()
print(f"Posición del cursor: {tablero.get_cursor()}")
print("\n\nUsa las flechas para moverte en el tablero")
print("Presiona enter para desbloquear una casilla")
print("El juego termina al encontrar todos los pares de emojis:)")
os.system(var)
print("¡GANASTE! :D")
sleep(3)
exit()
if __name__ == "__main__":
main()