-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
120 lines (112 loc) · 4.21 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import csv
import os
import time
class _GetchUnix:
def __init__(self):
import tty, sys
def __call__(self):
import sys, tty, termios
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(1)
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
return ch
getch = _GetchUnix()
def clearScreen():#define funcão clearScreen
os.system('cls' if os.name == 'nt' else 'clear')
def logoType():#define função logoType
clearScreen()
print("███╗ ███╗███████╗███╗ ███╗ █████╗ ██████╗ █████╗ ██╗ ██╗ ██████╗ ██╗ ██╗")
print("████╗ ████║██╔════╝████╗ ████║██╔══██╗██╔══██╗██╔══██╗██║ ██╔╝ ██╔══██╗╚██╗ ██╔╝")
print("██╔████╔██║█████╗ ██╔████╔██║███████║██████╔╝███████║█████╔╝ ██████╔╝ ╚████╔╝ ")
print("██║╚██╔╝██║██╔══╝ ██║╚██╔╝██║██╔══██║██╔══██╗██╔══██║██╔═██╗ ██╔═══╝ ╚██╔╝ ")
print("██║ ╚═╝ ██║███████╗██║ ╚═╝ ██║██║ ██║██║ ██║██║ ██║██║ ██╗ ██║ ██║ ")
print("╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ")
def mainconfigOpt():#define função mainconfigOpt
logoType()
print("Menu -> config")
print("1-Definir max e min\nx-Voltar")
configOpt = getch()
if configOpt == '1':
logoType()
path = './options.csv'
options = open(path, 'w')
options.write("0;0")
intmin = int(input("Definir tamanho mínimo: "))
intmax = int(input("Definir tamanho máximo: "))
if intmin > intmax:
print("Valores inválidos")
time.sleep(1)
return
vmin = str(intmin)
vmax = str(intmax)
vwrite = vmin+";"+vmax
options = open(path, 'w')
options.write(vwrite)
elif configOpt == 'x':
return
def aritFc():
logoType()
print("Menu -> Jogar -> Aritmética")
print("1-Adição\n2-Subtração\n3-Multiplicação\n4-Divisão\np-Modo anterior\nx-Voltar")
aritOpt = getch()
if aritOpt == 'x':
return
elif aritOpt == 'p':
clearScreen()
os.system("python3 aritAll.py")
aritpath = './aritmodeConfig.txt'
aritOptTxt = open(aritpath, 'w')
aritOptTxt.write(aritOpt)
aritOptTxt.close()
clearScreen()
os.system("python3 aritAll.py")
def algFc():
logoType()
print("Menu -> Jogar -> Álgebra")
print("1-Equação\nx-Voltar")
algOpt = getch()
if algOpt == 'x':
return
algpath = './algmodeConfig.txt'
algOptTxt = open(algpath, 'w')
algOptTxt.write(algOpt)
algOptTxt.close()
clearScreen()
os.system("python3 algAll.py")
def mainPlayOpt():#define função mainPlayOpt
while 1:
logoType()
print("Menu -> Jogar")
print("1-Aritmética\n2-Álgebra\nx-Voltar")
playOpt = getch()
if playOpt == '1':
aritFc()
elif playOpt == '2':
algFc()
elif playOpt == 'x':
return
def infoMenuOpt():
logoType()
print("A fazer...")
print("x - sair")
infoOpt = getch()
if infoOpt == 'x':
return
while 1:
logoType()
print("Menu")
print("1-Jogar\n2-Config\n3-Sobre\nx-Sair")
mainOpt = getch()
if mainOpt == '1':
mainPlayOpt()
elif mainOpt == '2':
mainconfigOpt()
elif mainOpt == '3':
infoMenuOpt()
elif mainOpt == 'x':
clearScreen()
exit()