本文整理汇总了Python中bot.Bot.update方法的典型用法代码示例。如果您正苦于以下问题:Python Bot.update方法的具体用法?Python Bot.update怎么用?Python Bot.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bot.Bot
的用法示例。
在下文中一共展示了Bot.update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: list
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import update [as 别名]
surr.append((bx-i,by-i))
surr.append((bx+i,by-i))
surr.append((bx-i,by+i))
surr.append((bx+i,by+i))
# filter out out of range and duplicate points, then zip in grid values
surr = list(set(filter(lambda (x,y): 0<=x<cells and 0<=y<cells, surr)))
sensor = [i for i in surr] # copy for drawing purposes
surr = [((x,y),grid[int(x)][int(y)]) for (x,y) in surr]
# then sort by value, giving priority to 'occupied' cells
surr.sort(key=lambda tup: tup[1])
#print surr
# tell bot what's up
#bot.update(surr)
print flatgrid
bot.update([(l,v) for (l,v) in flatgrid if v > 0]) # cheat! tell bot everything
s = pygame.Surface((side,side))
s.set_alpha(128)
# draw sensor
s.fill((125,125,125))
for (x,y) in sensor:
pygame.display.get_surface().blit(s, (x*side,y*side))
# draw bot
s.fill((0,0,255))
pygame.display.get_surface().blit(s, (bx*side,by*side))
# move bot for next update
moveRate = 1
botmovecount += 1
if botmovecount%moveRate == 0:
示例2: open
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import update [as 别名]
# coding: utf-8
__author__ = 'Harald Floor Wilhelmsen'
from bot import Bot
ircserver = 'irc.freenode.net'
channel = '#tihlde-drift'
botnick = 'falkner'
password = open('pw').read()
bot = Bot(ircserver, channel, botnick, password)
bot.connect()
while True:
bot.update()