Commit 6ebec5f8 authored by Ahmad Reza Cheraghi's avatar Ahmad Reza Cheraghi
Browse files

Correction of a logical bug in get_distance

parent 1be3d97a
......@@ -73,8 +73,8 @@ class TriangularGrid(Grid):
def get_distance(self,start,end):
if start[1] == end[1] and start[0] != end[0]:
return abs(end[0] - start[0])
elif (abs(end[0] - start[0]) - abs(end[1] - start[1])) * 0.5 > 0:
return abs(end[1] - start[1]) + (abs(end[0] - start[0]) - abs(end[1] - start[1])) * 0.5
elif abs(end[0] - start[0]) - (abs(end[1] - start[1]) * 0.5) > 0:
return abs(end[1] - start[1]) + abs(end[0] - start[0]) - ( abs(end[1] - start[1]) * 0.5 )
return abs(end[1] - start[1])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment