本文整理汇总了Python中term2048.game.Game.play方法的典型用法代码示例。如果您正苦于以下问题:Python Game.play方法的具体用法?Python Game.play怎么用?Python Game.play使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类term2048.game.Game
的用法示例。
在下文中一共展示了Game.play方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from term2048.game import Game [as 别名]
# 或者: from term2048.game.Game import play [as 别名]
def __init__(self, iterations=1, print_interval=1, delay=0, heuristic='most_empty', **kws):
self.delay = delay
self.heuristic = getattr(self, heuristic)
total_won, total_score, start_time = 0, 0, time()
for i in range(1, iterations):
game = Game(self.get_move, **kws)
self.board = game.board
won, score = game.play()
total_score += score
total_won += won
if i % print_interval == 0:
system('cls')
print 'iterations completed: ' + str(i)
print 'simulations per second: ' + str(i / (time() - start_time))
print 'average score: ' + str(total_score / i)
print 'total won: ' + str(total_won)
print 'proportion won: ' + str(total_won / i)