[RESOLVED] VB6.0: I need help debugging A* pathfinding program please.
I have attached the project to this posting as BuggedPathfindingAttempt.zip .
I can't seem to find the bug. I start at 308,308 with a destination of 300,300 as called in the form_load of form1.
But for some reason it bugs out and suddenly jumps to 615,616 and then again to 1230,1231. I can't figure out how it can make such large jumps in only 20 moves.
Please help me find the bug.
Debug output of the x,y cornet with the lowest F cost. This debug.print can be found in FindAndDrawPath.
I use a binary heap to sort PathOpen()'s .F value so that the lowest .F is always at PathOpen(0).
Binary heap functions are named BinaryHeapRemove and BinaryHeapAdd, but seem to be working correctly as far as I can tell. - Form2 has a text box that displayes the contents of the heap and appears to be sorted correctly.
PathClosed is my closed list. PathClosedList(5000, 5000) is used to quickly check of a node (x,y cordnet) is closed and stores an index number that refers to PathClosed. - PathClosedList will also be used in the yet to be done sub that will be able to quickly trace the path once it has been found.
Sub CheckAndMove checks to see if a node is closed using Function IsPathClosed .
If a node is open then Function CalcGCost calculates the G cost; a cost of 10 if moving straight and a cost of 15 if changing direction. MyEndPoint is going to be used to find the turns when tracing the completed path.
Then the node is added to the heap via Function BinaryHeapAdd.