From 2e6a5196fd452ee7de6ec15c5770db0a25d51cae Mon Sep 17 00:00:00 2001 From: Sven Anderson Date: Sun, 27 Dec 2015 12:52:30 +0100 Subject: [PATCH] Add execute() method to CubieCube --- kociemba/pykociemba/cubiecube.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kociemba/pykociemba/cubiecube.py b/kociemba/pykociemba/cubiecube.py index 41c7c37..e7a2657 100644 --- a/kociemba/pykociemba/cubiecube.py +++ b/kociemba/pykociemba/cubiecube.py @@ -58,6 +58,9 @@ def getURtoDF(idx1, idx2): class CubieCube(object): """Cube on the cubie level""" + __s_to_ax = {"U": 0, "R": 1, "F": 2, "D": 3, "L": 4, "B": 5} + __s_to_po = {"": 1, "2": 2, "'": 3} + # initialize to Id-Cube def __init__(self, cp=None, co=None, ep=None, eo=None): @@ -90,6 +93,13 @@ def toFaceCube(self): fcRet.f[_butya] = FaceCube.edgeColor[self.ep[i]][n] return fcRet + def execute(self, maneuver): + for move in maneuver.split(): + ax = self.__s_to_ax[move[0]] + po = self.__s_to_po[move[1:]] + for i in range(po): + self.multiply(moveCube[ax]) + def cornerMultiply(self, b): """ Multiply this CubieCube with another cubiecube b, restricted to the corners.