——技术凝聚实力 专业创新出版

# 贪婪最佳优先算法

struct Node
Node parent
float h
end

currentNode = startNode
add currentNode to closedSet

do
foreach Node n adjacent to currentNode
if closedSet contains n
continue
else
n.parent = currentNode
if openSet does not contain n
compute n.h
end
end
loop // 结束循环

if openSet is empty
break // 退出主循环
end

currentNode = Node with lowest h in openSet
remove currentNode from openSet
add currentNode to closedSet

until currentNode == endNode //end main do...until loop

curentNode = startNode
do
// 把邻接节点加入开放集合
foreach Node n adjacent to currentNode
if closedSet contains n
continue
else
n.parent = currentNode
if openSet does not contain n
compute n.h
end
end
loop
// 所有可能性都尝试过了
if openSet is empty
break
end
// 选择新的当前节点
currentNode = Node with lowest h in openSet
remove currentNode from openSet
until currentNode == endNode
// 如果路径解出， 通过栈重新构造路径
if currentNode == endNode
Stack path
Node n = endNode
while n is not null
push n onto path
n = n.parent
loop
else
// 寻路失败
end

#### 深入理解游戏中寻路算法

2017-07-28 20:49:08

#### 盘点即时战略游戏中高实用性寻路算法

2016-01-06 09:45:36

#### 即时战略游戏中实用的寻路算法总结与比较

2017-03-19 10:57:15

#### 游戏里的跨地图寻路算法

2018-05-10 20:17:59

#### RTS游戏中A*寻路算法优化

2014-05-17 23:00:19

#### 游戏编程中的寻路算法研究

2010-04-21 09:11:00

#### Unity3D架构设计NavMesh寻路

2015-07-17 10:28:48

#### Nav导航网格寻路

2015-04-02 15:52:13

#### 多边形寻路实现

2016-11-13 23:49:28

#### NAV导航网格寻路（6） -- 寻路实现

2017-04-17 10:03:53