本文整理汇总了Python中cube.Cube.corners_equal方法的典型用法代码示例。如果您正苦于以下问题:Python Cube.corners_equal方法的具体用法?Python Cube.corners_equal怎么用?Python Cube.corners_equal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cube.Cube
的用法示例。
在下文中一共展示了Cube.corners_equal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: find_unsolved
# 需要导入模块: from cube import Cube [as 别名]
# 或者: from cube.Cube import corners_equal [as 别名]
def find_unsolved(self, cube, print_debug=False):
#print "Finding unsolved " + self.__class__.__name__
unsolved = []
for face in Cube.faces:
for edge, edge2 in Cube.cw_corners_on_face(face):
if cube.get_color(face, edge, edge2) == 'white':
dest_face = 'down'
other_color = cube.get_color(edge, face, edge2)
dest_edge = cube.get_dest_face(other_color)
other_color2 = cube.get_color(edge2, face, edge)
dest_edge2 = cube.get_dest_face(other_color2)
already_solved = Cube.corners_equal( \
(face, edge, edge2), (dest_face, dest_edge, dest_edge2))
if not already_solved:
new_case = Unsolved(face, edge, edge2, dest_face, dest_edge, dest_edge2)
#print new_case
unsolved.append(new_case)
def sorter(u):
source_cubie = (u.source_face, u.source_edge, u.source_edge2)
dest_cubie = (u.dest_face, u.dest_edge, u.dest_edge2)
if cube.is_cubie_in_layer(source_cubie, 'up'):
assert dest_cubie[0] == 'down'
cubie_above_dest = ('up', u.dest_edge, u.dest_edge2)
if u.source_face != 'up':
if Cube.same_cubie(source_cubie, cubie_above_dest):
return 0
else:
return 1
else:
if Cube.same_cubie(source_cubie, cubie_above_dest):
return 2
else:
return 3
else:
return 4
unsolved.sort(key=sorter)
return unsolved