【发布时间】:2014-01-17 00:57:46
【问题描述】:
我的 a* 寻路算法仅适用于某些情况,但我不明白为什么。我网格中的每个节点都是可步行的,因此理论上每条路径都应该有效。我相信错误在这一行:
PathFindingNode *neighbor = NULL;
if ((y > 0 && x > 0) && (y < gridY - 1 && x < gridX - 1))
neighbor = [[grid objectAtIndex:x + dx] objectAtIndex:y +dy];
【问题讨论】:
标签: ios objective-c path-finding shortest-path a-star