Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ahmad Reza Cheraghi
swarm-sim
Commits
6ebec5f8
Commit
6ebec5f8
authored
Feb 07, 2020
by
Ahmad Reza Cheraghi
Browse files
Correction of a logical bug in get_distance
parent
1be3d97a
Changes
1
Hide whitespace changes
Inline
Side-by-side
grids/TriangularGrid.py
View file @
6ebec5f8
...
@@ -73,8 +73,8 @@ class TriangularGrid(Grid):
...
@@ -73,8 +73,8 @@ class TriangularGrid(Grid):
def
get_distance
(
self
,
start
,
end
):
def
get_distance
(
self
,
start
,
end
):
if
start
[
1
]
==
end
[
1
]
and
start
[
0
]
!=
end
[
0
]:
if
start
[
1
]
==
end
[
1
]
and
start
[
0
]
!=
end
[
0
]:
return
abs
(
end
[
0
]
-
start
[
0
])
return
abs
(
end
[
0
]
-
start
[
0
])
elif
(
abs
(
end
[
0
]
-
start
[
0
])
-
abs
(
end
[
1
]
-
start
[
1
])
)
*
0.5
>
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
return
abs
(
end
[
1
]
-
start
[
1
])
+
abs
(
end
[
0
]
-
start
[
0
])
-
(
abs
(
end
[
1
]
-
start
[
1
])
*
0.5
)
return
abs
(
end
[
1
]
-
start
[
1
])
return
abs
(
end
[
1
]
-
start
[
1
])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment