diff --git a/main.py b/main.py index e69de29..3843aa6 100644 --- a/main.py +++ b/main.py @@ -0,0 +1,6 @@ +def main(): + from src.init import inicio + from src.cartelas import TUI_principal + inicio() + TUI_principal() +main() \ No newline at end of file diff --git a/src/cartelas.py b/src/cartelas.py index 422f679..57361a4 100644 --- a/src/cartelas.py +++ b/src/cartelas.py @@ -1,5 +1,5 @@ -from constants import LOGGING, ERRORS, SELECTED -from funcoes import learquivo, escrevearquivo, cleanup +from src.constants import LOGGING, ERRORS, SELECTED +from src.funcoes import learquivo, escrevearquivo, cleanup def listas(): i = 0 vazio = '' @@ -24,7 +24,7 @@ def listas(): return vet def cartelas_show(): - from funcoes import aleatorio + from src.funcoes import aleatorio cartelas = listas() resultado = [0] * 4 randomold = 0 @@ -47,7 +47,7 @@ def donotabela(elemento_inicial): *************************************************** """) def maketable(elemento_inicial, lista, playerselect, backend_results): - from funcoes import aleatorio + from src.funcoes import aleatorio from prettytable import PrettyTable, DOUBLE_BORDER if elemento_inicial == "1": donotabela(elemento_inicial) @@ -121,5 +121,4 @@ def TUI_principal(): lista = cartelas_show() while True: os.system("cls || clear") - elemento_inicial = input(maketable(elemento_inicial, lista, playerselect, backend_results)) -TUI_principal() \ No newline at end of file + elemento_inicial = input(maketable(elemento_inicial, lista, playerselect, backend_results)) \ No newline at end of file diff --git a/src/constants.py b/src/constants.py index ec21166..95ed84b 100644 --- a/src/constants.py +++ b/src/constants.py @@ -7,9 +7,10 @@ TUTORIAL = { Certifique-se que tenha as bibliotecas necessárias instaladas - As bibliotecas podem ser instaladas rodando o arquivo 'setup.py' + Pressione ENTER para instalar as bibliotecas necessárias - Pressione ENTER para prosseguir + As bibliotecas podem ser instaladas posteriormente rodando o + arquivo 'setup.py' """ } SELECTED = { @@ -22,4 +23,9 @@ ERRORS = { LOGGING = { "listas": "listas() executado com sucesso", "cartelas_show": "cartelas_show() executado com sucesso" -} \ No newline at end of file +} +SCOREBOARD = { + "win": """ + Parabéns! Você venceu!!! + Entre o seu nome para constar no rol de vencedores: + """} \ No newline at end of file diff --git a/src/funcoes.py b/src/funcoes.py index 683c3e4..5b4a5d0 100644 --- a/src/funcoes.py +++ b/src/funcoes.py @@ -2,31 +2,31 @@ def aleatorio(x, y): import random return random.randint(x, y) -def criaarquivo(): +def criaarquivo(x): try: - arquivo = open('temp.json', 'r', encoding='utf-8') + arquivo = open(x, 'r', encoding='utf-8') arquivo.close() except FileNotFoundError: - arquivo = open('temp.json', 'w') + arquivo = open(x, 'w') arquivo.close() def learquivo(x,linha): - criaarquivo() + criaarquivo(x) arquivo = open(x, 'r', encoding='utf-8') x = arquivo.readlines(linha) arquivo.close() return x def escrevearquivo(x,input): - criaarquivo() + criaarquivo(x) arquivo = open(x, 'w') arquivo.write(input) arquivo.close() -def cleanup(): +def cleanup(x): import os - if os.path.exists("temp.json"): - os.remove("temp.json") + if os.path.exists(x): + os.remove(x) else: print("The file does not exist\n") diff --git a/src/init.py b/src/init.py index dd210c8..cfd3201 100644 --- a/src/init.py +++ b/src/init.py @@ -1,6 +1,6 @@ -from constants import TUTORIAL +from src.constants import TUTORIAL def inicio(): import os os.system("cls || clear") - input(TUTORIAL["start"]) -inicio() \ No newline at end of file + x = input(TUTORIAL["start"]) + os.system("pip install -r requirements.txt") \ No newline at end of file