Skip to content

fix: return infinity when no A* path exists - #159

Open
ToB213 wants to merge 1 commit into
adf-python:mainfrom
ToB213:fix/158-a-star-unreachable-distance
Open

ToB213 wants to merge 1 commit into
adf-python:mainfrom
ToB213:fix/158-a-star-unreachable-distance

Conversation

@ToB213

@ToB213 ToB213 commented Sep 17, 2026

Copy link
Copy Markdown

Summary

Fix AStarPathPlanning.get_distance() to return float("inf") when no path exists.

Previously, an unreachable destination returned 0.0 because the distance was calculated from an empty path. This made it indistinguishable from a valid zero-distance path where the source and destination are the same.

Changes

  • Return float("inf") when get_path() returns an empty list
  • Preserve 0.0 for a valid path from an entity to itself

Fixes #158

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should AStarPathPlanning.get_distance() return 0.0 when no path exists?

1 participant