unnecessary movements in my a-star implementation <p>I've made an a-star implementation with euclidean heuristics, and it works, but makes unnecessary movements in some situations. </p> <p>Here is the screenshot: <a href="http://clip2net.com/s/6v2iU4" rel="nofollow">http://clip2net.com/s/6v2iU4</a></p> <p>Path starts on the blue circle and, in theory, cell to the right of it has less F (movement cost + heuristic cost), so a-star takes it first, but it ends up in building not the shortest path.</p> <p>How can i fix this? Or a-star is supposed to work this way and i dont need to do anything?</p> <p>My code: <a href="http://pastebin.com/02u33jY6" rel="nofollow">http://pastebin.com/02u33jY6</a> (h + cpp)</p>