本文整理汇总了Python中cube.Cube.cw_neighbor_edges方法的典型用法代码示例。如果您正苦于以下问题:Python Cube.cw_neighbor_edges方法的具体用法?Python Cube.cw_neighbor_edges怎么用?Python Cube.cw_neighbor_edges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cube.Cube
的用法示例。
在下文中一共展示了Cube.cw_neighbor_edges方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: solve_case
# 需要导入模块: from cube import Cube [as 别名]
# 或者: from cube.Cube import cw_neighbor_edges [as 别名]
def solve_case(self, cube, unsolved, print_debug=False):
case = unsolved[0]
steps = []
if case.source_face == 'up':
steps.append(cube.get_simple_move(
'up', case.source_edge, case.dest_edge))
steps.append((case.dest_edge, 2))
elif case.source_face == 'down':
steps.append((case.source_edge, 2))
steps.append(cube.get_simple_move(
'up', case.source_edge, case.dest_edge))
steps.append((case.dest_edge, 2))
elif case.source_edge == 'up':
neighbors = Cube.cw_neighbor_edges('up')
index = neighbors.index(case.dest_edge)
dest_edge_offset = neighbors[(index + 1) % 4]
steps.append(cube.get_simple_move(
'up', case.source_face, dest_edge_offset))
steps.append((dest_edge_offset, 1))
steps.append((case.dest_edge, 3))
steps.append((dest_edge_offset, 3))
else:
face, times = cube.get_simple_move(case.source_face, case.source_edge, 'up')
steps.append((face, times))
steps.append(('up', 1))
steps.append((face, -times % 4))
return steps
示例2: find_unsolved
# 需要导入模块: from cube import Cube [as 别名]
# 或者: from cube.Cube import cw_neighbor_edges [as 别名]
def find_unsolved(self, cube, print_debug=False):
unsolved = []
for n in Cube.cw_neighbor_edges('up'):
up_color = cube.get_color('up', n)
if up_color != 'yellow':
unsolved.append(Unsolved(n, 'up', None, 'up', n, None))
return unsolved
示例3: move_with_y_rotation
# 需要导入模块: from cube import Cube [as 别名]
# 或者: from cube.Cube import cw_neighbor_edges [as 别名]
def move_with_y_rotation(move, num_rotations=1):
num_rotations = num_rotations % 4
face, times = move
if num_rotations == 0 or face == 'up' or face == 'down':
return move
up_cw_neighbor_edges = Cube.cw_neighbor_edges('up')
new_face_index = (up_cw_neighbor_edges.index(face) - num_rotations) % 4
return (up_cw_neighbor_edges[new_face_index], times)