开发者

Different results from Dijkstra algorithms

I am working from Programming Game AI by Example book. Look at this image, the result on the left is the author's, the one on the right is mine. Green is source and red is target. Dijkst开发者_如何学JAVAra is applied, and you can see the shortest path but also the other paths that were searched. How come my image is different, what could this mean?

Different results from Dijkstra algorithms


At a very quick glance it looks like they weight diagonal walks heavier then vertical or horizontal ones. Yours looks like it weighs going n,s,w,e,ne,nw,se,sw all the same. Hence you go diagonal when they went horizontal or vertical.


It seems that you just used different tiebreakers when selecting the next square. From what I see you searched the same squares in the same amount of time, but in the part where you arbitrarily pick the next square to search, you chose differently.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜