本文整理汇总了Python中animal.Animal.make_random_animal方法的典型用法代码示例。如果您正苦于以下问题:Python Animal.make_random_animal方法的具体用法?Python Animal.make_random_animal怎么用?Python Animal.make_random_animal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类animal.Animal
的用法示例。
在下文中一共展示了Animal.make_random_animal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from animal import Animal [as 别名]
# 或者: from animal.Animal import make_random_animal [as 别名]
# If run as a script, run the unit tests for this module.
# otherwise, don't
if __name__ == "__main__":
printer.start()
farmyard = farm.Farm(INIT_BOARD_SIZE)
# Set up the page refresh metronome
draw_thread = threading.Thread(target=draw_board, args=(farmyard,))
draw_thread.daemon = True
draw_thread.start()
# Make the Animals
animals = [(a, threading.Thread(target=a.run)) for
a in [Animal.make_random_animal(farmyard) for _ in range(NUM_ANIMALS)]]
for (a, t) in animals:
t.daemon = True
map(lambda (_,t): t.start(), animals)
# Set up the stats window
stats = Stats(animals, farmyard)
stats_thread = threading.Thread(target=stats_loop, args=(stats,))
stats_thread.daemon = True
stats_thread.start()
# We shouldn't need this, but curses is not happy otherwise
time.sleep(0.05)
# consume the prompts
prompt_loop(farmyard, animals, stats)
# for _ in printer.prompt_inputs():