本文整理汇总了Python中simulator.Simulator.render方法的典型用法代码示例。如果您正苦于以下问题:Python Simulator.render方法的具体用法?Python Simulator.render怎么用?Python Simulator.render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simulator.Simulator
的用法示例。
在下文中一共展示了Simulator.render方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from simulator import Simulator [as 别名]
# 或者: from simulator.Simulator import render [as 别名]
hit_goal = False
while run_active:
# check for end of time
total_time += 1
if total_time > max_time:
run_active = False
print 'Allotted time exceeded.'
break
# provide robot with sensor information, get actions
sensing = [testmaze.dist_to_wall(robot_pos['location'], heading)
for heading in dir_sensors[robot_pos['heading']]]
rotation, movement = testrobot.next_move(sensing)
# render simulator
simulator.render()
# check for a reset
if (rotation, movement) == ('Reset', 'Reset'):
if run == 0 and hit_goal:
run_active = False
runtimes.append(total_time)
print 'Ending first run. Starting next run.'
break
elif run == 0 and not hit_goal:
print 'Cannot reset - robot has not hit goal yet.'
continue
else:
print 'Cannot reset on runs after the first.'
continue