|
|
@ -1,6 +1,10 @@
|
|
|
|
from db import *
|
|
|
|
from db import *
|
|
|
|
from math import floor
|
|
|
|
from math import floor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# DEBUG
|
|
|
|
|
|
|
|
from icecream import ic
|
|
|
|
|
|
|
|
ic.disable()
|
|
|
|
|
|
|
|
|
|
|
|
db = read_db()
|
|
|
|
db = read_db()
|
|
|
|
|
|
|
|
|
|
|
|
# Составные
|
|
|
|
# Составные
|
|
|
@ -18,7 +22,7 @@ def sround(num, parts):
|
|
|
|
good = False
|
|
|
|
good = False
|
|
|
|
while not good:
|
|
|
|
while not good:
|
|
|
|
num = floor(num)
|
|
|
|
num = floor(num)
|
|
|
|
print(good, ' ', num)
|
|
|
|
ic(good, ' ', num)
|
|
|
|
st = 1 ; good = True
|
|
|
|
st = 1 ; good = True
|
|
|
|
# Перебираем различное количество частей
|
|
|
|
# Перебираем различное количество частей
|
|
|
|
while st < parts:
|
|
|
|
while st < parts:
|
|
|
@ -97,8 +101,14 @@ def calc(el, amount, main = False):
|
|
|
|
# Считаем 1 часть
|
|
|
|
# Считаем 1 часть
|
|
|
|
part = sround(amount/parts, parts)
|
|
|
|
part = sround(amount/parts, parts)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Динамический объём
|
|
|
|
|
|
|
|
# Нужен когда у вещества вход 20 а выход 10
|
|
|
|
|
|
|
|
#part_vol =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Перебираем составные и делаем рекурсию
|
|
|
|
# Перебираем составные и делаем рекурсию
|
|
|
|
for i in comps:
|
|
|
|
for i in comps:
|
|
|
|
|
|
|
|
ic(i)
|
|
|
|
if i[0] in db:
|
|
|
|
if i[0] in db:
|
|
|
|
lpart = calc(i[0], part*i[1])
|
|
|
|
lpart = calc(i[0], part*i[1])
|
|
|
|
# Если наша часть больше чем составная
|
|
|
|
# Если наша часть больше чем составная
|
|
|
@ -107,6 +117,7 @@ def calc(el, amount, main = False):
|
|
|
|
# lpart - количество составного в итоге
|
|
|
|
# lpart - количество составного в итоге
|
|
|
|
# 50/3, часть = 16, ИТОГ: 16*3=48 <
|
|
|
|
# 50/3, часть = 16, ИТОГ: 16*3=48 <
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if heat and not main:
|
|
|
|
if heat and not main:
|
|
|
|
recipe = [['heat']] + recipe
|
|
|
|
recipe = [['heat']] + recipe
|
|
|
|
if heat and main:
|
|
|
|
if heat and main:
|
|
|
@ -124,15 +135,14 @@ def calc(el, amount, main = False):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
recipe.append([i[0], part*i[1]])
|
|
|
|
recipe.append([i[0], part*i[1]])
|
|
|
|
|
|
|
|
|
|
|
|
# ЕСЛИ ЕСТЬ БАГИ ВЕРОЯТНО ЭТО ТУТ
|
|
|
|
# Если нету плазмы и нагрева - соединяем вещества
|
|
|
|
# Если нету плазмы - соединяем вещества
|
|
|
|
|
|
|
|
if main:
|
|
|
|
if main:
|
|
|
|
if ll_find(recipe, 'Плазма') == None and not heat:
|
|
|
|
if ll_find(recipe, 'Плазма') == None and ll_find(recipe, 'heat') == None:
|
|
|
|
print('START: ', recipe)
|
|
|
|
ic('START: ', recipe)
|
|
|
|
new_recipe = []
|
|
|
|
new_recipe = []
|
|
|
|
#for i in recipe:
|
|
|
|
|
|
|
|
while recipe != []:
|
|
|
|
while recipe != []:
|
|
|
|
print("ORIG:", recipe)
|
|
|
|
ic("ORIG:", recipe)
|
|
|
|
el = recipe[0]
|
|
|
|
el = recipe[0]
|
|
|
|
new_recipe.append(el)
|
|
|
|
new_recipe.append(el)
|
|
|
|
del recipe[0]
|
|
|
|
del recipe[0]
|
|
|
@ -142,28 +152,33 @@ def calc(el, amount, main = False):
|
|
|
|
|
|
|
|
|
|
|
|
# Если есть ещё такой элемент
|
|
|
|
# Если есть ещё такой элемент
|
|
|
|
while ll_find(recipe, el[0]):
|
|
|
|
while ll_find(recipe, el[0]):
|
|
|
|
|
|
|
|
# Если это отметка для нагрева
|
|
|
|
|
|
|
|
if el[0] == 'heat':
|
|
|
|
|
|
|
|
break
|
|
|
|
same_id = ll_find(recipe, el[0])
|
|
|
|
same_id = ll_find(recipe, el[0])
|
|
|
|
print('OLD: ', new_recipe[id][1])
|
|
|
|
ic('OLD: ', new_recipe[id][1])
|
|
|
|
new_recipe[id][1] += recipe[same_id][1]
|
|
|
|
new_recipe[id][1] += recipe[same_id][1]
|
|
|
|
print('NEW: ', new_recipe[id][1] + recipe[same_id][1])
|
|
|
|
ic('NEW: ', new_recipe[id][1] + recipe[same_id][1])
|
|
|
|
# Удаляем этот элемент
|
|
|
|
# Удаляем этот элемент
|
|
|
|
#recipe.pop( same_id )
|
|
|
|
|
|
|
|
del recipe[same_id]
|
|
|
|
del recipe[same_id]
|
|
|
|
|
|
|
|
|
|
|
|
print("NEW:", new_recipe)
|
|
|
|
ic("NEW:", new_recipe)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
recipe = new_recipe
|
|
|
|
recipe = new_recipe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if main:
|
|
|
|
if main:
|
|
|
|
print('PART: ', part)
|
|
|
|
ic(part)
|
|
|
|
return [recipe, out*part]
|
|
|
|
return [recipe, out*part]
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
print(recipe)
|
|
|
|
ic(recipe)
|
|
|
|
print(el)
|
|
|
|
ic(el)
|
|
|
|
print('PART: ', part)
|
|
|
|
ic('PART: ', part)
|
|
|
|
return part*parts
|
|
|
|
# >>>>>>>>>>>>>>> Возможен баг <<<<<<<<<<<<
|
|
|
|
|
|
|
|
#return part*parts
|
|
|
|
|
|
|
|
# Возвращаем объём=часть*выход
|
|
|
|
|
|
|
|
return part*out
|
|
|
|
|
|
|
|
|
|
|
|
#print( calc("Лексорин", 100, True))
|
|
|
|
#print( calc("Лексорин", 100, True))
|
|
|
|
#print( calc("Бикаридин", 100, True))
|
|
|
|
#print( calc("Бикаридин", 100, True))
|
|
|
@ -172,3 +187,16 @@ def calc(el, amount, main = False):
|
|
|
|
#print( calc("Криоксадон", 100, True) )
|
|
|
|
#print( calc("Криоксадон", 100, True) )
|
|
|
|
#print( calc("Гидроксид", 100, True) )
|
|
|
|
#print( calc("Гидроксид", 100, True) )
|
|
|
|
#print( calc("Пунктураз", 100, True) )
|
|
|
|
#print( calc("Пунктураз", 100, True) )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#print( calc("Эпинефрин", 100, True) )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#print( calc("Гидроксид", 100, True) )
|
|
|
|
|
|
|
|
#print( calc("Ацетон", 50, True) )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#print( calc("Фенол", 50, True) )
|
|
|
|
|
|
|
|
#print(calc("Бензол", 50, True))
|
|
|
|
|
|
|
|
#OK print( calc("Гидроксид", 50, True) )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#print( calc("", 100, True) )
|
|
|
|
|
|
|
|
#print( calc("", 100, True) )
|
|
|
|
|
|
|
|
#print( calc("", 100, True) )
|
|
|
|