| Home | Trees | Indices | Help |
|---|
|
|
Rubik's cube group functions
\label{sec:rubik}
NOTE: ``Rubik's cube'' is trademarked. We shall omit the trademark symbol
below for simplcity.
NOTATION: B denotes a clockwise quarter turn of the back face
D denotes a clockwise quarter turn of the down face
and similarly for F (front), L (left), R (right), U (up)
Products of moves are read {\it right to left}, so for example,
R*U means move U first and then R.
See \code{CubeGroup.parse()} for all possible input notations.
The "Singmaster notation":
* moves: U, D, R, L, F, B as in the diagram below,
* corners: xyz means the facet is on face x (in R,F,L,U,D,B)
and the clockwise rotation of the corner sends x->y->z
* edges: xy means the facet is on face x and a flip of the edge sends x->y.
sage: rubik = CubeGroup()
sage: rubik.display2d("")
+--------------+
| 1 2 3 |
| 4 top 5 |
| 6 7 8 |
+------------+--------------+-------------+------------+
| 9 10 11 | 17 18 19 | 25 26 27 | 33 34 35 |
| 12 left 13 | 20 front 21 | 28 right 29 | 36 rear 37 |
| 14 15 16 | 22 23 24 | 30 31 32 | 38 39 40 |
+------------+--------------+-------------+------------+
| 41 42 43 |
| 44 bottom 45 |
| 46 47 48 |
+--------------+
AUTHOR:
- David Joyner (2006-10-21): first version
- " (2007-05): changed faces, added legal and solve
- " (2007-06): added plotting functions
- " (2007-08): colors corrected, "solve" rewritten (again),typos fixed.
- Robert Miller (2007-08): editing, cleaned up display2d
- Robert Bradshaw (2007-08): RubiksCube object, 3d plotting.
- DJ (2007-09): rewrote docstring for CubeGroup's "solve".
- Robert Bradshaw (2007-09): Versatile parse function for all input types.
- Robert Bradshaw (2007-11): Cleanup.
REFERENCES:
Cameron, P., Permutation Groups. New York: Cambridge University Press, 1999.
Wielandt, H., Finite Permutation Groups. New York: Academic Press, 1964.
Dixon, J. and Mortimer, B., Permutation Groups, Springer-Verlag, Berlin/New York, 1996.
Joyner, D, Adventures in Group Theory, Johns Hopkins Univ Press, 2002.
|
|||
|
CubeGroup A python class to help compute Rubik's cube group actions. |
|||
|
RubiksCube sage: C = RubiksCube().move("R U R'")... |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
polygon = Sage polygon; type polygon? for help and examples
|
|||
text = type text? for help and examples
|
|||
pi = 3.14159265359
|
|||
named_colors =
|
|||
face_polys =
|
|||
singmaster_indices =
|
|||
cubie_center_list =
|
|||
cubie_face_list =
|
|||
rand_colors =
|
|||
_ = 55
|
|||
blue =
|
|||
green =
|
|||
lgrey =
|
|||
lightblue =
|
|||
lpurple =
|
|||
orange =
|
|||
purple =
|
|||
red =
|
|||
white =
|
|||
yellow =
|
|||
|
|||
Plots a polygon viewed from an angle determined by tilt, turn, and vertices
points.
WARNING: The ordering of the points is important to get "correct" and
if you add several of these plots together, the one added first is also
drawn first (ie, addition of Graphics objects is not commutative).
The following example produced a green-colored square with vertices
at the points indicated.
EXAMPLES:
sage: from sage.groups.perm_gps.cubegroup import *
sage: P = polygon_plot3d([[1,3,1],[2,3,1],[2,3,2],[1,3,2],[1,3,1]],rgbcolor=green)
|
Input a list of ints 1, ..., m (in any order), outputs inverse perm.
EXAMPLES:
sage: from sage.groups.perm_gps.cubegroup import *
sage: L = [2,3,1]
sage: inv_list(L)
[3, 1, 2]
|
Translates index used (eg, 43) to Singmaster facet notation (eg, fdr).
EXAMPLES:
sage: from sage.groups.perm_gps.cubegroup import *
sage: index2singmaster(41)
'dlf'
|
Returns the color the facet has in the solved state.
EXAMPLES:
sage: from sage.groups.perm_gps.cubegroup import *
sage: color_of_square(41)
'blue'
|
Plots the front, up and right face of a cubie centered at cnt and rgbcolors given by clrs (in the
order FUR).
Type P.show() to view.
EXAMPLES:
sage: from sage.groups.perm_gps.cubegroup import *
sage: clrF = blue; clrU = red; clrR = green
sage: P = plot3d_cubie([1/2,1/2,1/2],[clrF,clrU,clrR])
|
This provides a map from the 6 faces of the 27 cubies to the 48 facets of the larger cube. -1,-1,-1 is left, top, front |
|
|||
named_colors
|
face_polys
|
singmaster_indices
|
cubie_center_list
|
cubie_face_list
|
rand_colors
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0beta1 on Thu Jul 17 04:23:26 2008 | http://epydoc.sourceforge.net |