SharedRubik 2x3x3.sagewsOpen in CoCalc
Rubik 233
# 定義 2x3x3 方塊中的三個轉軸（左、前、上、右）的順轉方向
G233 = PermutationGroup(['(1,2,3,4)(9,10,11,12)','(1,6)(2,5)(9,13)','(2,7)(6,3)(10,14)','(3,8)(4,7)(11,15)'])
G233

Permutation Group with generators [(3,8)(4,7)(11,15), (2,7)(3,6)(10,14), (1,2,3,4)(9,10,11,12), (1,6)(2,5)(9,13)]
# 取得三個轉軸的名稱 R U F，並定義其逆轉方向
O = G233.gen(0)
G = G233.gen(1)
U = G233.gen(2)
Q = G233.gen(3)
V = U^(-1)
# 檢驗 P == R^
U
Q*Q

(1,2,3,4)(9,10,11,12) ()
# 觀察基本操作的複合，效果為三個位置輪調
Q*U
U*Q
Q*V
V*Q
Q*V*Q*U
V*Q*U*Q # (Q*V*Q*U)**(-1)
Q*U*Q*V
U*Q*V*Q # (Q*V*Q*U)**(-1)

(1,6,2,5,3,4)(9,13,10,11,12) (1,5,2,3,4,6)(9,10,11,12,13) (1,6,4,3,2,5)(9,13,12,11,10) (1,4,3,5,2,6)(9,12,11,10,13) (1,2,3,5,6)(9,10,13) (1,6,5,3,2)(9,13,10) (1,4,6,5,2)(9,12,13) (1,2,5,6,4)(9,13,12)
Q*U*U
U*U*Q
Q*U*U*Q*U*U*Q*U*U


(1,6,3)(2,5,4)(9,13,11)(10,12) (1,3,6)(2,4,5)(9,11,13)(10,12) (10,12) (1,6,2,5,3,4)(9,13,10,11,12)
#配合3x3x3 的模擬來觀察
GRubik = RubiksCube()
GRubik.show3d()
R*V
#上左 R*V 有兩組三個位置輪調
(R*V)^3 #上左三次 (R*V)^3 位置歸位、但方向會轉
GRV = GRubik.move("(R*U^3)")
#GRV.show3d()
GRV3 = GRubik.move("(R*U^3)*(R*U^3)*(R*U^3)")
GPU3 = GRubik.move("R^3*U*R^3*U*R^3*U")
#GRV3.show3d()
GPU3.show3d()

3D rendering not yet implemented
*** WARNING: Code contains non-ascii characters *** Error in lines 3-3 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags) in namespace, locals File "", line 1, in <module> TypeError: unsupported operand type(s) for *: 'type' and 'sage.groups.perm_gps.permgroup_element.PermutationGroupElement'
(R*V)^3 # 上右三次：位置不動 方向 (-+-- ++==)
(P*U)^3 # 下左三次：位置不動 方向 (-+++ --==)
(R*V)^3*(P*U)^3 # 位置不動 1順轉2逆轉 (-+== ====)
GRVPU = GRubik.move("R*U^3*R*U^3*R*U^3*R^3*U*R^3*U*R^3*U")
GRVPU.show3d()

*** WARNING: Code contains non-ascii characters *** Error in lines 1-1 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags) in namespace, locals File "", line 1, in <module> TypeError: unsupported operand type(s) for *: 'type' and 'sage.groups.perm_gps.permgroup_element.PermutationGroupElement'
(R*V*P*U)
(R*V*P*U)^2
GRVPU = GRubik.move("R*U^3*R^3*U")
GRVPU.show3d()
GRVPU2 = GRubik.move("R*U^3*R^3*U*R*U^3*R^3*U")
GRVPU2.show3d()
#GRVPU2.plot()

Error in lines 1-1 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags) in namespace, locals File "", line 1, in <module> TypeError: unsupported operand type(s) for *: 'type' and 'sage.groups.perm_gps.permgroup_element.PermutationGroupElement'
#RU2PV RU2 JU PV L 交換 1,2 個的位置（且保持上方的方塊朝上）
GRV2PV = GRubik.move("R*U^2*R^3*U^3") #上左左下右
GRV2PVRVPV2 = GRubik.move("R*U^2*R^3*U^3*R*U^3*R^3*U^2") #上右右下右上右下右右
GRU2PVRU2JUPVL = GRubik.move("R*U^2*R^3*U^3*R*U*U*L^3*U*R^3*U^3*L")
#GRV2PVRVPV2.show3d() #上左左下右
GRU2PVRU2JUPVL.show3d()

3D rendering not yet implemented