From e18edce982dd9c9e1b4fa429ed284d83b83cff07 Mon Sep 17 00:00:00 2001 From: ViktorSemericov Date: Wed, 29 Oct 2025 15:54:47 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20wrapper.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wrapper.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wrapper.py b/wrapper.py index 349cde7..d2d461e 100644 --- a/wrapper.py +++ b/wrapper.py @@ -22,5 +22,12 @@ if __name__=='__main__': user_position.append(val_output['coordinates']['lon']) else: print('Адрес не найден') - route = build_route(found_points, mapping,user_position,user_time,5) - print(route) + n_nodes = len(mapping) + allow_extend = any(v[1] for v in mapping.values()) + print(len(mapping),allow_extend) + route =0 + if allow_extend: + while n_nodes <= 5 and (route := build_route(found_points, mapping, user_position, user_time, n_nodes,strategy='random') or route): n_nodes += 1 + else: + route= build_route(found_points, mapping, user_position, user_time, n_nodes,strategy='random') + print(route) \ No newline at end of file