xtaci / algorithms

Algorithms & Data structures in C++.
MIT License
5.19k stars 1.51k forks source link

Swapped indexes in astar.h #24

Closed fwanderlingh closed 10 years ago

fwanderlingh commented 10 years ago

Hey man, while using your fantastic rep I encountered a bug in the astar header, in particular the indexing of the grid in the neighbor search when using nx,ny and cx,cy where swapped. That was causing the algorithm to search blocks that could be occupied by walls if the map was different from the sample one. I'm using your astar header in one of my repositories, so if you want feel free to have a look at the changes I've done :wink:

I'm not using the github tools to fork the rep and request a merge since I'm somehow new to git and I don't want to create a mess :tongue:

xtaci commented 10 years ago

yes ,it's true. i'll try to fix this problem. if you get familiar with git , you can just simply "pull requests". thanks guy!

xtaci commented 10 years ago

I've done some optimization to the astar algorithm, and also some comments.