本文整理汇总了Python中gamestate.GameState.run方法的典型用法代码示例。如果您正苦于以下问题:Python GameState.run方法的具体用法?Python GameState.run怎么用?Python GameState.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gamestate.GameState
的用法示例。
在下文中一共展示了GameState.run方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: len
# 需要导入模块: from gamestate import GameState [as 别名]
# 或者: from gamestate.GameState import run [as 别名]
if min_val > cur_val:
min_val = cur_val
best_new_loc = (row, col)
best_directions = [cur_direction]
elif min_val == cur_val:
best_directions.append(cur_direction)
if len(best_directions) > 0:
ants.issue_order((ant_loc, choice(best_directions)))
# check if we still have time left to calculate more orders
if ants.time_remaining() < 10:
break
if __name__ == "__main__":
# psyco will speed up python a little, but is not needed
try:
import psyco
psyco.full()
except ImportError:
pass
try:
# if run is passed a class with a do_turn method, it will do the work
# this is not needed, in which case you will need to write your own
# parsing function and your own game state class
GameState.run(MyBot())
except KeyboardInterrupt:
print("ctrl-c, leaving ...")