mirror of
https://github.com/Justuser3310/ss14_chemistry_site.git
synced 2025-01-18 16:58:48 +00:00
up
This commit is contained in:
parent
45ec9a1157
commit
0a98ef930b
@ -8,7 +8,7 @@ def expand_recipe(recipe, recipes, main = False):
|
|||||||
part = 1 # Одна часть
|
part = 1 # Одна часть
|
||||||
while not ok:
|
while not ok:
|
||||||
ok = True
|
ok = True
|
||||||
min_vol = 0 # Объём мин. рецепта (вход)
|
vol_in = 0 # Объём мин. рецепта (вход)
|
||||||
# Перебираем элементы
|
# Перебираем элементы
|
||||||
for el in recipe:
|
for el in recipe:
|
||||||
# Если составное
|
# Если составное
|
||||||
@ -20,19 +20,19 @@ def expand_recipe(recipe, recipes, main = False):
|
|||||||
expanded = {}
|
expanded = {}
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
min_vol += expand_recipe(recipes[el].comps, recipes)
|
vol_in += expand_recipe(recipes[el].comps, recipes)
|
||||||
else:
|
else:
|
||||||
if el in expanded:
|
if el in expanded:
|
||||||
expanded[el] += recipe[el]*part
|
expanded[el] += recipe[el]*part
|
||||||
else:
|
else:
|
||||||
expanded[el] = recipe[el]*part
|
expanded[el] = recipe[el]*part
|
||||||
|
|
||||||
min_vol += recipe[el]*part
|
vol_in += recipe[el]*part
|
||||||
|
|
||||||
if main:
|
if main:
|
||||||
return expanded, min_vol, part
|
return expanded, vol_in, part
|
||||||
else:
|
else:
|
||||||
return min_vol
|
return vol_in
|
||||||
|
|
||||||
def calc(element, amount, recipes):
|
def calc(element, amount, recipes):
|
||||||
# Получаем характеристику элемента
|
# Получаем характеристику элемента
|
||||||
|
Loading…
Reference in New Issue
Block a user