From 22b2a0ec27b1ff5d95fb8885adc6823f50790ad0 Mon Sep 17 00:00:00 2001 From: justuser31 Date: Wed, 1 May 2024 15:14:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8,=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BC=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=80=D0=B8=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reworked/calc.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/reworked/calc.py b/reworked/calc.py index 1d5cfb9..c26ac20 100644 --- a/reworked/calc.py +++ b/reworked/calc.py @@ -1,12 +1,15 @@ -def expand_recipe(recipe, recipes, main = False): +def expand_recipe(recipe, recipes): global expanded ok = False - part = 1 + part = 1 # Одна часть while not ok: ok = True + # Перебираем элементы for el in recipe: + # Если составное if el in recipes: + # Одна часть должна делиться без остатка! if part % recipes[el].out != 0: ok = False part += 1 @@ -26,7 +29,7 @@ def calc(element, amount, recipes): global expanded expanded = {} - expand_recipe(recipe, recipes, True) + expand_recipe(recipe, recipes) return expanded