Skip to content

Use heuristics! #1

@LeftBankTwo

Description

@LeftBankTwo

I used your code to go through a maze for me.
I modified your passable?() function so it wouldn't pass through my walls walls and everything worked great!
However, it was checking EVERYWHERE, except those places it physically couldn't get to due to the passable?() function. It found the optimal path but not in the optimal way!

I looked through the code and noticed that your heuristics functions was only called once, only when creating a new node! It wasn't actually used practically and properly anywhere, it's just there. It should be used to calculate the best direction to go and keeping that direction because it approaches the destination, but it just sits there, doing nothing but just being there.

The heuristics must be used, they are not thus making this an invalid A* algorithm! The node number should be much lower because it should try to keep in the direction of the destination node rather than putting nodes everywhere it can, it should put the nodes where passable? and closest to the destination rather than anywhere that's passable!

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

    Issue actions