A* admissible heuristics on a grid with teleporters?

前端 未结 2 780
情歌与酒
情歌与酒 2021-02-01 19:33

Suppose that you have a 2D grid of cells, some of which are filled in with walls. Characters can take a step from one square to any square that is one step horizontal or vertic

2条回答
  •  我在风中等你
    2021-02-01 20:29

    If there aren't too many teleporters in your world, I would try the following heuristic, where MHD(a,b) is Manhattan distance between cell a and b and T(i) is the teleporter nearest to cell i:

    h(x,y) = min( MHD(x,y), MHD(x,T(x)) + MHD(T(y),y) )
    

提交回复
热议问题