Sign in to follow this  
silverphyre673

Pathfinding program in c++ has uncommon, evil bug - please help me find it!

Recommended Posts

I suppose this could have been posted under the AI section... but it really has more to do with the actual language. The interface should be fairly intuitive: I wrote a pathfinding program in c++ for a 2d coordinate system where the user specifies an initial position, destination, and map file (stores spaces that are clear/blocked from movement). The program then loops, moving the position to get closer to the destination, without going through blocked spaces, showing the movement graphically, and taking (approximately) the shortest route. There is this strange bug where occasionally the movement coordinate will move through a clipped square. If you like, would you please help me figure out the problem? The source is here: http://home.comcast.net/~silverphyre673/ and is the only link (besides the email address) on the page. The program will actually be useful, once its done, to people making games - see the readme (I will protect it under the GPL). Your help is very much appreciated! Thanks.

Share this post


Link to post
Share on other sites
Compiled it, wanted to let you know I got this error.


v2.cpp: In function `void pause()':
v2.cpp:12: error: new declaration `void pause()'
/usr/include/unistd.h:414: error: ambiguates old declaration `int pause()'


Under SUSE, so I changed the name of pause.

Share this post


Link to post
Share on other sites
Quote:
Original post by silverphyre673
I suppose this could have been posted under the AI section... but it really has more to do with the actual language. The interface should be fairly intuitive:

I wrote a pathfinding program in c++ for a 2d coordinate system where the user specifies an initial position, destination, and map file (stores spaces that are clear/blocked from movement). The program then loops, moving the position to get closer to the destination, without going through blocked spaces, showing the movement graphically, and taking (approximately) the shortest route. There is this strange bug where occasionally the movement coordinate will move through a clipped square. If you like, would you please help me figure out the problem? The source is here:
http://home.comcast.net/~silverphyre673/

and is the only link (besides the email address) on the page. The program will actually be useful, once its done, to people making games - see the readme (I will protect it under the GPL). Your help is very much appreciated! Thanks.


I haven't looked at the source (no time), but from what i see, you've got a problem in your move-maker.

Make sure that moves that are impossible, arn't considered. (so then you don't get the bug).

From,
Nice coder

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this