Skip to content

suboptimal path with diagonal and manhattan #49

@caryoscelus

Description

@caryoscelus

i changed example to allow diagonal movement and experimented a little with it. seems like manhattan fails to find shortest solution under certain conditions. e.g. it produces this
manhattan
instead of
good
(which is produced by other heuristics)

Activity

MWFIAE

MWFIAE commented on Mar 24, 2025

@MWFIAE

In Manhattan distance you only care about the distance in terms of horizontal and vertical movement, not about the number of nodes in between. So imho, the calculated solution is equally correct with the one you get from other heuristics or even this one:

Image

Its always 4 horizontally and 5 vertically

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @caryoscelus@MWFIAE

        Issue actions

          suboptimal path with diagonal and manhattan · Issue #49 · digitsensitive/astar-typescript