当前位置: 首页>>代码示例>>Python>>正文


Python Cube.cw_neighbor_edges方法代码示例

本文整理汇总了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
开发者ID:buggi22,项目名称:cube-solver,代码行数:29,代码来源:solver.py

示例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
开发者ID:buggi22,项目名称:cube-solver,代码行数:9,代码来源:solver.py

示例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)
开发者ID:buggi22,项目名称:cube-solver,代码行数:11,代码来源:solver.py


注:本文中的cube.Cube.cw_neighbor_edges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。