From d1b3b3e88afe6ecaf36c4bfba0ab20a350f72197 Mon Sep 17 00:00:00 2001 From: Boris Zaitsev Date: Fri, 26 Jul 2019 14:03:43 +0500 Subject: [PATCH] Update helpers.py is_intersect: manhattan dist Now is_intersect returns True if difference in any axis (x or y) between players less than width. Thiat results to issue with double death in case when they pathes are perpendicular and both players start and end points (elementar cells, grid crosses) are valid. Replacing condition to comparing width with manhattan dist makes this issue fixed. --- paperio/local_runner/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paperio/local_runner/helpers.py b/paperio/local_runner/helpers.py index ad3008b..5c4a411 100644 --- a/paperio/local_runner/helpers.py +++ b/paperio/local_runner/helpers.py @@ -197,4 +197,4 @@ def get_random_coordinates(): def is_intersect(p1, p2, width=WIDTH): x1, y1 = p1 x2, y2 = p2 - return abs(x1 - x2) < width and abs(y1 - y2) < width + return abs(x1 - x2) + abs(y1 - y2) < width