Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / A* Pathfinder Help

Author
Message
NanoGamez guy
17
Years of Service
User Offline
Joined: 13th Jan 2007
Location: Closer than you think...
Posted: 19th May 2008 19:37 Edited at: 20th May 2008 22:38
Hi,

I've been making an A* Pathfinder Algolithm and I'm having a bit of trouble because it's no finding the shortest path. Take a look at the code below:



There are two sets of data statements at the bottom, to view the other one, just turn

rem start

into

remstart

When the path is displayed, the arrow in the middle indicates the parent of that node, the number at the bottom left is the cost of moving from its parent node to it, the number at the bottom right is the heuristic and the number at the top is the two added together. If a node is in a yellow box, then it is on the open list, if it is in a purple box, then its is on the closed list. The green node is the start and the red one is the end.

Any help would greatly appreciated.

[EDIT] Found the problem - When looking at a node and finding out the cost of moving to that node, I wasn't adding the cost of moving to the previous node to the cost of moving to that node. Because of that, when trying to shorten the path it was only analyzing the cost of moving from node to node, and not the cost of moving from the start all the way to that node.

I know that this might not make sense to those of you who haven't made an A* Pathfinder, but the important thing is that it works.


What are the chemical formulae of:
Sodium Nitrate, Gallium, Manganese and Einsteinium

Login to post a reply

Server time is: 2024-05-03 02:49:26
Your offset time is: 2024-05-03 02:49:26