寻路算法:A*寻路算法(For 初学者)



This article has been translated o Spanish and French. Other translations are welcome.

While it is easy _disibledevent=>
[图 1][Figure 1]

The first thing you should notice is that we have divided our search area o a square grid. Simplying the search area, as we have done here, is the first step in pathfinding. This particular method reduces our search area to a simple two dimensional .gif' />. Each item in the .gif' /> represents _disibledevent=>

  • Look at all the reachable or walkable squares adjacent to the starting po, ignoring squares with walls, water, or other illegal terrain. Add them to the open list, too. For each of these squares, save po A as its \"parent square\". This parent square stuff is important when we want to trace our path. It will be explained more later.
  • 观察开始点邻近所有可到达或可行走方块忽略有墙水或其他非法地形方块也把它们添加到开放列表对每个方块保存A 点作为它们“父亲”这个父亲方块在跟踪路径时非常重要后面会更多解释
  • Drop the starting square A from your open list, and add it to a \"closed list\" of squares that you don\'t need to look at again for now.
  • 把开始方块A从开放列表中取出并放到“封闭列表”内它是所有现在不需要再关注方块列表
  • At this po, you should have something like the following illustration. In this diagram, the dark green square in the center is your starting square. It is outlined in light blue to indicate that the square has been added to the closed list. All of the adjacent squares are now _disibledevent=>
    [图 2][Figure 2]

    Next, we choose one of the adjacent squares on the open list and more or less repeat the earlier process, as described below. But which square do we choose? The one with the lowest F cost.
    我们从开放列表中选出个相邻方块然后多多少少重复早先过程下面会说到但是我们选择哪个呢?具有最小F值那个



    Tags:  选路算法 寻峰算法 寻路算法原理 寻路算法

    延伸阅读

    最新评论

    发表评论