FINDPATH - least cost heuristic doesn't work

Previous topic - Next topic

Wampus

When I use FINDPATH with heuristic 1.0 the result should be the path with least cost. I'm not sure what heuristic 1.0 is doing but finding the least cost path is definitely not it!

I've attached a little test proggy to demonstrate what I mean. The red path is heuristic 0.0 and the blue path is heuristic 1.0. Lower down the screen is shown the number of path steps that have to be taken and the cost of the path. As you will see, something odd is happening.

Please excuse the awfulness of the code. I wrote the routine a long time ago and just never thought to mention the issue.



[attachment deleted by admin]

Hark0

http://litiopixel.blogspot.com
litiopixel.blogspot.com - Desarrollo videojuegos Indie · Pixel-Art · Retroinformática · Electrónica Development Indie Videogames · Pixel-Art · Retrocomputing · Electronic

Warwick

I have also found that FINDPATH does not usually find the least-cost path. If two paths are equal in length then it will pick the least cost of those. However it will always pick the shortest path first, and only consider cost if alternative paths are equally short. It does not seem to matter what the heuristic parameter is set to.