Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

魔術方塊

Project: RubikCube
Views: 133
# 定義 2x2x2 方塊中的三個轉軸(左、前、上、右)的順轉方向 G = PermutationGroup(['(3,7,8,4)','(2,6,7,3)','(1,2,3,4)','(1,5,6,2)']) G
Permutation Group with generators [(3,7,8,4), (2,6,7,3), (1,2,3,4), (1,5,6,2)]
# 取得三個轉軸的名稱 R U F,並定義其逆轉方向 L = G.gen(0) F = G.gen(1) U = G.gen(2) R = G.gen(3) J = L^(-1) E = F^(-1) V = U^(-1) P = R^(-1) # 檢驗 P == R^ U R U*R
(1,2,3,4) (1,5,6,2) (2,3,4,5,6)
# 觀察基本操作的複合,效果為三個位置輪調 R*V R*U (R*V)^3 (R*U)^5 V*R (V*R)^3 P*U U*P (U*P)^3
(1,5,6)(2,4,3) (1,5,6,3,4) () () (1,4,3)(2,5,6) () (1,3,4)(2,6,5) (1,6,5)(2,3,4) ()
#配合3x3x3 的模擬來觀察 GRubik = RubiksCube() GRubik.show3d()
3D rendering not yet implemented
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()
(1,5,6)(2,4,3) ()
3D rendering not yet implemented
(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()
() () ()
3D rendering not yet implemented
(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()
(1,2)(3,6) ()
3D rendering not yet implemented
3D rendering not yet implemented
#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