Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Astar Bug..

Credits go to Edgar Reynaldo for helping out!
This thread is locked; no one can reply to it. rss feed Print
Astar Bug..
Ariesnl
Member #2,902
November 2002
avatar

Hey everyone,

I thought I finally managed to implement astar..
I first tried it with a simple map consisting of vectors of vectors, containing tiles
now for performance I switched to vectors containing pointers to objects..
But now my algorithm seems to make a lot of mistakes..

and I have no idea why... :-/

Anyone want to help ?

Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard)
Current project: [Star Trek Project ] Join if you want ;-)

Edgar Reynaldo
Member #8,592
May 2007
avatar

I got your program to build and run. What am I looking at with the red squares, black squares, and green dots?

I'll help you debug if you help me understand where to look.

Ariesnl
Member #2,902
November 2002
avatar

the red squares are not passable
the black squares are passable
the green dots( now white circles) are the path from 2,2 to 50,50

I think I found the bug, for some reason x and y are reversed..

try it .. now with n you can get a new random path ( all starting from 2,2)

thx for looking at it ;-)

if you have any suggestions for improvement, please do so

Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard)
Current project: [Star Trek Project ] Join if you want ;-)

Edgar Reynaldo
Member #8,592
May 2007
avatar

The screen starts blank, I press n and a path comes up. Pressing n again doesn't really do anything, and it seems to hang up and not want to close.

Go to: