A* question
I found an implementation of A* shown below that someone wrote on codeproject.com that's perfect for what I need, but there's an issue: http://www.codeproject.com/cs/algorithms/seunghyopback.asp It's on a 2d grid and doesn't take diagonal movement costs into consideration, so there's a lot of sidestepping. I'm wondering where do I include this consideration. I tried putting it in the node class by changing "g" to 1.5 under certain conditions, but I get a compile error since the IComparer interface uses "g" and doesn't really like floats so I'm wondering what else I should try. In the comments at the bottom of the codeproject page someone brought this up, but his answer wasn't completely clear for me.
Rewrite the comparison function.
Or make horizontal and vertical movements cost 10 and make diagonal movements cost 14.
Or make horizontal and vertical movements cost 10 and make diagonal movements cost 14.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement