Package sage :: Package groups :: Package perm_gps :: Module cubegroup :: Class RubiksCube
[hide private]
[frames] | no frames]

Class RubiksCube

source code

                      object --+    
                               |    
structure.sage_object.SageObject --+
                                   |
                                  RubiksCube


sage: C = RubiksCube().move("R U R'")
sage: C.show3d()

sage: C = RubiksCube("R*L"); C
             +--------------+
             | 17    2   38 |
             | 20   top  36 |
             | 22    7   33 |
+------------+--------------+-------------+------------+
| 11  13  16 | 41   18    3 | 27   29  32 | 48  34   6 |
| 10 left 15 | 44  front  5 | 26 right 31 | 45 rear  4 |
|  9  12  14 | 46   23    8 | 25   28  30 | 43  39   1 |
+------------+--------------+-------------+------------+
             | 40   42   19 |
             | 37 bottom 21 |
             | 35   47   24 |
             +--------------+
sage: C.show()
sage: C.solve(algorithm='gap')  # long time
'L R'
sage: C == RubiksCube("L*R")
True



Instance Methods [hide private]
 
__init__(self, state=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., history=[], colors=[(1, 0.63, 1), (1, 1, 0), (1, 0, 0), (0, 1, 0), (1, 0.6, 0.3),...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
move(self, g) source code
 
undo(self) source code
 
__repr__(self)
File: sage/structure/sage_object.pyx (starting at line 86)
source code
 
facets(self) source code
 
plot(self)
File: sage/structure/sage_object.pyx (starting at line 95)
source code
 
show(self) source code
 
cubie(self, size, gap, x, y, z, colors, stickers=True) source code
 
plot3d(self, stickers=True)
sage: C = RubiksCube().move("R*U")...
source code
 
show3d(self) source code
 
__cmp__(self, other) source code
 
solve(self, algorithm='hybrid', timeout=15)
Algorithm must be one of : hybrid - try kociemba for timeout seconds, then dietz kociemba - Use Dik T.
source code
 
scramble(self, moves=30) source code

Inherited from structure.sage_object.SageObject: __hash__, __new__, _axiom_, _axiom_init_, _gap_, _gap_init_, _gp_, _gp_init_, _interface_, _interface_init_, _interface_is_cached_, _kash_, _kash_init_, _macaulay2_, _macaulay2_init_, _magma_, _magma_init_, _maple_, _maple_init_, _mathematica_, _mathematica_init_, _maxima_, _maxima_init_, _octave_, _octave_init_, _pari_, _pari_init_, _r_init_, _sage_, _singular_, _singular_init_, category, db, dump, dumps, rename, reset_name, save, version

Inherited from object: __delattr__, __getattribute__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, state=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., history=[], colors=[(1, 0.63, 1), (1, 1, 0), (1, 0, 0), (0, 1, 0), (1, 0.6, 0.3),...)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 
File: sage/structure/sage_object.pyx (starting at line 86)

Overrides: structure.sage_object.SageObject.__repr__
(inherited documentation)

plot(self)

source code 
File: sage/structure/sage_object.pyx (starting at line 95)

Overrides: structure.sage_object.SageObject.plot
(inherited documentation)

plot3d(self, stickers=True)

source code 

sage: C = RubiksCube().move("R*U")
sage: C.plot3d()
sage: C.plot()

solve(self, algorithm='hybrid', timeout=15)

source code 

Algorithm must be one of : 
   hybrid    - try kociemba for timeout seconds, then dietz
   kociemba  - Use Dik T. Winter's program       (reasonable speed, few moves)
   dietz     - Use Eric Dietz's cubex program     (fast but lots of moves)
   optimal   - Use Michael Reid's optimal program (may take a long time)
   gap       - Use GAP word solution              (can be slow)
   
EXAMPLE: 
    sage: C = RubiksCube("R U F L B D")
    sage: C.solve()
    'R U F L B D'
    
Dietz's program is much faster, but may give highly non-optimal solutions. 
    sage: s = C.solve('dietz'); s
    "U' L' L' U L U' L U D L L D' L' D L' D' L D L' U' L D' L' U L' B' U' L' U B L D L D' U' L' U L B L B' L' U L U' L' F' L' F L' F L F' L' D' L' D D L D' B L B' L B' L B F' L F F B' L F' B D' D' L D B' B' L' D' B U' U' L' B' D' F' F' L D F'"
    sage: C2 = RubiksCube(s)
    sage: C == C2
    True