-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
59 lines (49 loc) · 1.46 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
from chloroplast.reactions import simulation
from menu_tools import *
variables = {
'nº H2O': 0,
'nº CO2': 0,
'nº RuDP': 0,
'nº ADP': 0,
'nº NADP+': 0,
'Oxitation energy': 0,
'Light intensity': 0,
'Radiation': []
}
try:
file = open('RADIATION_INTERVALES.txt', 'r')
values = file.read().split()
variables['Radiation'] = [[int(values[i]), int(values[i + 1])] for i in range(0, len(values), 2)]
file.close()
except Exception as error:
print(f'There is a error in impress data: {error.__class__}')
exit()
line()
print('ChloroplastCode v1.0.0\n\
Copyright \u00a9 André Pinheiro\n\
Read the licence for more information')
line()
print('Welcome to the ChloroplastCode! For start a simulation, you\n\
need the set the follow variables:')
# Menu loop for check values
state = True
while state:
# Set all variables except "radiation"
for key in variables:
if key != 'Radiation':
variables[key] = read_int(f'{key}: ')
line()
# Show all variable value typed
for key in variables:
print(f'{key} -> {variables[key]}')
line()
# Ask for check all values
while True:
cont = input('Are you sure? [Y/N] ').strip().upper()
if cont == 'Y' or cont == 'N':
state = False if cont == 'Y' else True
break
line()
# Load countdown and simulatin functions
countdown()
simulation(*[value for key, value in variables.items()])