首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Tron的好启发式

Tron的好启发式
EN

Stack Overflow用户
提问于 2013-04-29 15:51:18
回答 2查看 3.4K关注 0票数 3

我有一个任务,要用AI做一个tron游戏。我和我的团队几乎成功了,但我们正在努力寻找一个很好的启发式方法。我们教授关于Voronoi的知识,但它有点慢:

代码语言:javascript
复制
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三角剖分吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-04-29 20:46:34

有关这一点,请查看the postmortem of Google's AI Challenge

票数 5
EN

Stack Overflow用户

发布于 2013-11-05 04:38:04

好吧,我正在考虑重新设计我的旧Wurmeler游戏(包括AI ),所以我在寻找新想法的时候偶然发现了你的问题,所以这是我对旧AI的见解

  • Wurmeler类似于tron,但许多解算器和蠕虫平滑地转向
  • 游戏空间是2D位图
  • 每个AI都非常简单...愚蠢,...
  • 但导航比我
  • 更好,除非他们被其他玩家
  • 关闭或挤入本地最小/最大
  • ,但它们仍然很有趣

<代码>F215

好的,现在AI算法在每一步决策中:

  1. 从蠕虫

创建几条光线

代码语言:javascript
复制
- one in movement direction
- few turned to the left by some angle (5 degree step is fine)
- few turned to the right

  1. evaluate ray length

代码语言:javascript
复制
- from worm until it hit border
- or another worm path curve 

  1. 使用最大值规则更改标题

这个老的AI只维护导航,但我想实现更多(这还没有完成):

  1. divide map to square sections

代码语言:javascript
复制
- each section will have the average density of already filled space
- so if possible AI will choose less filled area

  1. add strategies

(为添加策略)

代码语言:javascript
复制
- navigate (already done)
- flee (go away from near player if too close and behind)
- attack (if on relative parallel course and too close and in the front) 

可以将

  1. 从栅格转换为矢量

代码语言:javascript
复制
- should speed up the ray traceing and colision detection
- but with growing length may be slower ... have to try it and see
- possible use of field algorithms

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16273676

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档