本文整理汇总了Python中cube.Cube.apply_sequence方法的典型用法代码示例。如果您正苦于以下问题:Python Cube.apply_sequence方法的具体用法?Python Cube.apply_sequence怎么用?Python Cube.apply_sequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cube.Cube
的用法示例。
在下文中一共展示了Cube.apply_sequence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from cube import Cube [as 别名]
# 或者: from cube.Cube import apply_sequence [as 别名]
num_trials = 1000
scramble_moves_per_trial = 100
results = []
successes = 0
attempts = 0
for i in range(1, num_trials + 1):
cube = Cube()
scramble = cube.generate_scramble_sequence(
moves=scramble_moves_per_trial, seed=i)
cube.apply_sequence(scramble)
result = ""
if cube.is_solved():
result += "NOTE: cube was already solved! "
solution = Solver().find_solution(cube)
attempts += 1
cube.apply_sequence(solution)
success = cube.is_solved()
if success:
result += "Successfully solved!"
successes += 1
else:
result += "Could not solve"