我有一个任务是制作一款带有人工智能的电子游戏。我和我的团队已经快完成了,但我们正在尝试寻找一个好的启发式方法。我们考虑使用沃罗诺伊图,但它运行速度有点慢:
for yloop = 0 to height-1
for xloop = 0 to width-1
// Generate maximal value
closest_distance = width * height
for point = 0 to number_of_points-1
// calls function to calc distance
point_distance = distance(point, xloop, yloop)
if point_distance < closest_distance
closest_point = point
end if
next
// place result in array of point types
points[xloop, yloop] = point
next
next
我们只有5秒钟时间来采取行动,这个算法听起来并不好!我不需要代码......我们只需要一个想法! 谢谢!
后来编辑:我们应该尝试 Delaunay 三角剖分吗?