本文整理汇总了Python中Robot.Robot.tick方法的典型用法代码示例。如果您正苦于以下问题:Python Robot.tick方法的具体用法?Python Robot.tick怎么用?Python Robot.tick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Robot.Robot
的用法示例。
在下文中一共展示了Robot.tick方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Simulation
# 需要导入模块: from Robot import Robot [as 别名]
# 或者: from Robot.Robot import tick [as 别名]
class Simulation():
def __init__(self):
self.town = Town(maxShops = 10)
self.town.render(DisplayDriver.engine)
self.robot = Robot(random.choice(list(self.town.shopDict)), town = self.town)
self.robot.render(DisplayDriver.engine)
self.consumeText = OnscreenText(pos = [Globals.RESOLUTION[0]-200,0], text = '', size = 20)
self.consumeText.render(DisplayDriver.engine)
self.distanceText = OnscreenText(pos = [Globals.RESOLUTION[0]-200,20], text = '', size = 20)
self.distanceText.render(DisplayDriver.engine)
self.contraintsText = OnscreenText(pos = [Globals.RESOLUTION[0]-200,30], text = '', size = 20)
self.contraintsText.render(DisplayDriver.engine)
def tick(self):
self.robot.tick()
self.distanceText.setText('Distance: %sm' %(int(self.robot.getDistanceTraveled())))
self.consumeText.setText('Fuel Used: %s' %(int(self.robot.getFuelUsed())))
try:
self.contraintsText.setText('Distance/Fuel: %s' %(round(self.robot.getDistanceTraveled()/self.robot.getFuelUsed(), 2)))
except ZeroDivisionError:
pass
示例2: Simulation
# 需要导入模块: from Robot import Robot [as 别名]
# 或者: from Robot.Robot import tick [as 别名]
class Simulation():
def __init__(self):
self.town = Town(maxShops = 10)
self.town.render(DisplayDriver.engine)
self.robot = Robot(random.choice(list(self.town.shopDict)), town = self.town)
self.robot.render(DisplayDriver.engine)
def tick(self):
self.robot.tick()
示例3: lel
# 需要导入模块: from Robot import Robot [as 别名]
# 或者: from Robot.Robot import tick [as 别名]
class lel():
def __init__(self):
self.t = None
self.mouseText = OnscreenText(pos=[0,0], text = '', size = 20)
self.mouseText.render(DisplayDriver.engine)
def new(self, event=None):
if self.t:
self.t.destroy()
self.r.destroy()
self.t = Town(maxShops=15)
self.t.render(DisplayDriver.engine)
self.r = Robot(random.choice(list(self.t.shopDict)), town = self.t)
self.r.calcPath()
self.r.render(DisplayDriver.engine)
def kek(self, event):
self.mouseText.setPos(event.pos)
self.mouseText.setText(str(event.pos))
def tick(self):
self.r.tick()