一个明星
算法 a-star python 例子:
import astar
# structure_maps - arrays map[x][y] = float 0-1
structure_maps = [
[ 1 , 1 , 1 , 0 , .5 , 1 ],
[ 1 , 1 , .5 , 0 , .5 , 1 ]
[ 1 , 1 , .5 , .5 , .5 , 1 ]
[ 1 , 1 , .5 , 0 , 1 , .5 ]
[ 1 , 1 , .5 , 0 , 1 , .5 ]
]
# diagonal - diagonal (True/False)
diagonal = False
astar = astar . AStar ( structure_maps , diagonal )
# set start [x, y]
astar . start ([ 2 ,
2022-06-25 21:24:15
4KB
Python
1