我有一個可以和AI做一個tron遊戲的分配。我的團隊幾乎成功了,但我們試圖找到一個很好的啓發。我們教約維諾,但它有點慢:Tron的好啓發式
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秒內做出的舉動和此算法不`噸聽起來好得!我不需要代碼......我們只需要一個ideea! 謝謝!
後來編輯:我們應該嘗試德勞內三角?
任何使您能夠查詢快速鄰居的數據結構正在那裏工作。查找KD-Trees /四叉樹。 – 2013-04-29 08:26:59
嗯......謝謝!我會看看它:)。 – Matei 2013-04-29 08:44:31