人工智能课件第五次课.pptVIP

  • 2
  • 0
  • 约3.88千字
  • 约 41页
  • 2019-04-17 发布于贵州
  • 举报
* 中华民族有着五千多年的文明历史,中华民族在世界上是一个非常卓越和伟大的民族。我们有过繁荣昌盛的唐朝,有过强盛无比疆域辽阔的汉朝和元朝,更有灿烂美丽的唐、宋文化 A*路径搜索 A* Pathfinding We are going to discuss the fundamentals of the A* pathfinding algorithm. 基本A*路径搜索算法 The A* Algorithm provides an effective solution to the problem of pathfinding. 定义搜索区域 Defining the search area The first step in pathfinding is to define the search area. 首先定义搜索区域。 The game world needs to be represented by points that both the game characters and objects can occupy. We need to reduce the nodes to a manageable number, which is what we mean when we say we need to simplify the search area. 减少搜索区域的节点数量,简化搜索区域。 定义搜索区域 Defining the search area 基于方块的搜索区域 Tiled search area Starting the search We will use the A* algorithm to find the shortest path between any two nodes while avoiding the obstacles. 避开障碍在任意两点之间用A*算法获得最短路径。 OpenList-We need a way to keep track of which tiles need to be searched. 可以作为后备检测的点的集合; ClosedList-the tiles that already were checked. 已经检测完成的点的集合。 A*伪代码 A* pseudo code Add the starting node to the open list While the open list is not empty { current node=node from open list with the lowest cost if current node=goal node then path complete else move current node to the closed list examine each node adjacent to the current node for each adjacent node if it isn’t on the open list and isn’t on the closed list and it isn’t an obstacle then move it to open list and calculate cost } A*伪代码 A* pseudo code 将开始点加到Open List表中; 重复一下过程,直到Open List表空为止: { 当前点=OpenList表中代价值最小的点; 如果当前点为目标点, 则 搜索完成; 否则 将当前点移到ClosedList表中; 对与当前点相连的每一点,重复执行: 如果该点不在OpenList、ClosedList,并且不是障碍点 则 将该点移到OpenList表中,计算该点的代价值; } Create a tiled search area Spider-starting point Human character-destination Solid black squares-wall obstacles Adjacent tiles to consider We proceed to check each of the eight adjacent tiles and then add each

文档评论(0)

1亿VIP精品文档

相关文档