Skip to content

Commit

Permalink
Update helpers.py is_intersect: manhattan dist
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
boriszaitsev authored Jul 26, 2019
1 parent 7ded1e9 commit d1b3b3e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion paperio/local_runner/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d1b3b3e

Please sign in to comment.