本文整理汇总了Python中bot.Bot.setGoals方法的典型用法代码示例。如果您正苦于以下问题:Python Bot.setGoals方法的具体用法?Python Bot.setGoals怎么用?Python Bot.setGoals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bot.Bot
的用法示例。
在下文中一共展示了Bot.setGoals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import setGoals [as 别名]
# draw room labels
for row in range(cells):
for col in range(cells):
if grid[row][col] > 1:
text = font.render(chr(65+grid[row][col]-2),True,black)
screen.blit(text, [col*side,row*side])
# helper things for bot
bx,by = bot.getLoc()
flatgrid = [i for l in grid for i in l]
gridpts = [(x,y) for y in range(cells) for x in range(cells)]
flatgrid = zip(gridpts,flatgrid)
# make array of (loc, val) tuples for all goals in grid
goals = [(l,v) for (l,v) in flatgrid if v > 1]
bot.setGoals(goals)
# make array of bot surroundings...'lasers' in cardinal directions
botRange = 4
surr = []
#consider drawing botrange? (showing horizontal, vertical, etc. 'beams')
# Generate points to analyze in surroundings
for i in range(botRange):
surr.append((bx+i,by))
surr.append((bx-i,by))
surr.append((bx,by+i))
surr.append((bx,by-i))
surr.append((bx-i,by-i))
surr.append((bx+i,by-i))
surr.append((bx-i,by+i))