本文整理汇总了Python中Simulator.Simulator.reset方法的典型用法代码示例。如果您正苦于以下问题:Python Simulator.reset方法的具体用法?Python Simulator.reset怎么用?Python Simulator.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Simulator.Simulator
的用法示例。
在下文中一共展示了Simulator.reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getMove
# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import reset [as 别名]
def getMove(self, grid):
# Create simulator
simulator = Simulator(grid)
highest_score = 0
best_move = None
# Do a depth-first search of the movement space, 1 moves ahead
move_options = [moves.MoveUp(simulator), moves.MoveRight(simulator), moves.MoveLeft(simulator), moves.MoveDown(simulator)]
for move in move_options:
move.execute()
if grid != simulator._grid:
score = self._score_grid(simulator._grid)
if score > highest_score:
highest_score = score
best_move = move
#else:
# print "Score too low: %s and %s" % (highest_score, score)
#else:
# print "No affect on the grid"
simulator.reset()
best_move.player = self.player
return best_move