寻路/ a *算法的解释?

时间:2018-01-04 16:30:57

标签: python algorithm path find a-star

有人想解释我(在伪代码中)如何在Python中实现pathfinding / a *算法?我在互联网上搜索但我无法理解如何计算H成本或G成本。我找到了一些源代码,但对我来说太难了(我还是新手)。

我想我有这样的地图:

'''
S0000000000000000000000000100000000000
00000000000000000000100000001000000000
10000111110101000001100000001000000000
01111100010001000010100000010000000000
00000100001111100100100001110000110000
00001100000001011000000100000001000000
00000100000000101000000000011110000001
00000010000000000111111111100000000011
00000001000000000000000001100000111100
00000000110000000000000000010011000000
00000000010000000001100000001000000000
00000000010000000000110000000111111000
00000000010000000000010000000000000000
00000000011000111111111111111111111111
000000000100000110000010000000000000E0
00000000001100000100001000000000000000
00000000000100000011000000000000000000
00000000000010000000000000000000000000
'''

1s是障碍,' S'是起点和E'结束了。 我该如何实现该算法?如果你可以链接一个能够轻松解释它的网页,那就太好了。

0 个答案:

没有答案