Results 1 to 4 of 4

Thread: [RESOLVED] VB6.0: I need help debugging A* pathfinding program please.

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2006
    Posts
    172

    Resolved [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.
    Code:
    308,308
    615,616
    616,615
    616,617
    617,616
    1230,1231
    1229,1232
    1232,1229
    1231,1230
    1233,1230
    1230,1233
    1232,1231
    1231,1232
    1232,1233
    1233,1232
    1231,1234
    1234,1231
    1234,1233
    1235,1232
    A bit more on how the program is suppose to work:

    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.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width