def getstate_edge(self, fc, lc): edge_faceids = fc[self.edge_faces] edge_cubieids = np.right_shift(edge_faceids, 2) - 8 # -8 is here since # we start the edge cubie ids at 8 and lehmer code # requires the permutations to start at zero edge_cubie_index = lc.encode(edge_cubieids) return edge_cubie_index
def getstate(self, fc, lc): corner_faceids = fc[self.corner_faces] corner_cubieids = np.right_shift(corner_faceids, 2) corner_orientids = np.bitwise_and(corner_faceids, 3)[0:-1] corner_cubie_index = lc.encode(corner_cubieids) corner_cubie_index = corner_cubie_index * 2187 corner_orient_index = np.sum(corner_orientids * np.array([729,243,81,27,9,3,1], dtype=np.int)) return corner_cubie_index + corner_orient_index
def getstate(self, fc, lc): corner_faceids = fc[self.corner_faces] # Get the corner cubie faces corner_cubieids = np.right_shift(corner_faceids, 2) # This picks out the # cube ids in the higher bits corner_orientids = np.bitwise_and(corner_faceids, 3)[0:-1] # This picks # out the lowest two bits that encode orientations corner_cubie_index = lc.encode(corner_cubieids) corner_cubie_index = corner_cubie_index * 2187 corner_orient_index = np.sum(corner_orientids * np.array([729,243,81,27,9,3,1], dtype=np.int)) return corner_cubie_index + corner_orient_index # combine cubie and orientation
def getstate_edgesplit(self, fc, lc, frsti): edge_faceids = fc[self.edge_faces][frsti::2] # 12 pick 7 if frsti == 0: edge_faceids = np.append(edge_faceids,fc[9]) else: edge_faceids = np.append(edge_faceids,fc[4]) edge_cubieids = np.right_shift(edge_faceids, 2) - 8 edge_orientids = np.bitwise_and(edge_faceids, 3) edge_cubie_index = lc.encode(edge_cubieids) # 12 pick 6 #edge_cubie_index = edge_cubie_index * 64 #edge_orient_index = np.sum(edge_orientids * np.array([32,16,8,4,2,1], dtype=np.int)) # 12 pick 7 edge_cubie_index = edge_cubie_index * 128 edge_orient_index = np.sum(edge_orientids * np.array([64,32,16,8,4,2,1], dtype=np.int)) return edge_cubie_index + edge_orient_index
def getstate_edgesplit(self, fc, lc, frsti): edge_faceids = fc[self.edge_faces][frsti::2] # nominally select # the odd for one set of 6 edges # and even for the other set of 6 edges # 12 pick 7 # add one edge cube to each set if frsti == 0: edge_faceids = np.append(edge_faceids,fc[41]) else: edge_faceids = np.append(edge_faceids,fc[43]) edge_cubieids = np.right_shift(edge_faceids, 2) - 8 # -8 here to set # cube ids to start at zero for edges edge_orientids = np.bitwise_and(edge_faceids, 3) edge_cubie_index = lc.encode(edge_cubieids) # 12 pick 6 #edge_cubie_index = edge_cubie_index * 64 #edge_orient_index = np.sum(edge_orientids * np.array([32,16,8,4,2,1], dtype=np.int)) # 12 pick 7 edge_cubie_index = edge_cubie_index * 128 edge_orient_index = np.sum(edge_orientids * np.array([64,32,16,8,4,2,1], dtype=np.int)) return edge_cubie_index + edge_orient_index
def getstate_edge(self, fc, lc): edge_faceids = fc[self.edge_faces] edge_cubieids = np.right_shift(edge_faceids, 2) - 8 edge_cubie_index = lc.encode(edge_cubieids) return edge_cubie_index