diagrams-rubiks-cube-0.2.0.0: Library for drawing the Rubik's Cube.

Safe HaskellNone
LanguageHaskell2010

Diagrams.RubiksCube.Model

Contents

Synopsis

Constructing cubes

data Side a Source

One side of the Rubik's Cube with 3*3 facets.

Constructors

Side 

Fields

_topLeft :: a
 
_topCenter :: a
 
_topRight :: a
 
_middleLeft :: a
 
_middleCenter :: a
 
_middleRight :: a
 
_bottomLeft :: a
 
_bottomCenter :: a
 
_bottomRight :: a
 

topLeft :: forall a. Lens' (Side a) a Source

topCenter :: forall a. Lens' (Side a) a Source

topRight :: forall a. Lens' (Side a) a Source

middleLeft :: forall a. Lens' (Side a) a Source

middleCenter :: forall a. Lens' (Side a) a Source

middleRight :: forall a. Lens' (Side a) a Source

bottomLeft :: forall a. Lens' (Side a) a Source

bottomCenter :: forall a. Lens' (Side a) a Source

bottomRight :: forall a. Lens' (Side a) a Source

rotateSideCW :: Aut (Side a) Source

Rotate the side clockwise.

rotateSideCCW :: Aut (Side a) Source

Rotate the side counter-clockwise.

data Cube a Source

A cube with six sides.

     +---+
     | u |
 +---+---+---+---+
 | l | f | r | b |
 +---+---+---+---+
     | d |
     +---+

Constructors

Cube 

Fields

_frontSide :: a
 
_backSide :: a
 
_leftSide :: a
 
_rightSide :: a
 
_upSide :: a
 
_downSide :: a
 

frontSide :: forall a. Lens' (Cube a) a Source

backSide :: forall a. Lens' (Cube a) a Source

leftSide :: forall a. Lens' (Cube a) a Source

rightSide :: forall a. Lens' (Cube a) a Source

upSide :: forall a. Lens' (Cube a) a Source

downSide :: forall a. Lens' (Cube a) a Source

newtype RubiksCube a Source

A normal Rubik's cube with 6 sides with 9 facets each.

Constructors

RubiksCube 

Fields

_cube :: Cube (Side a)
 

cube :: forall a a. Iso (RubiksCube a) (RubiksCube a) (Cube (Side a)) (Cube (Side a)) Source

Selecting rows and columns

data Vec3 a Source

A list of fixed length 3.

Constructors

Vec3 a a a 

topRow :: Lens' (Side a) (Vec3 a) Source

The top three facets (from left to right).

middleRow :: Lens' (Side a) (Vec3 a) Source

The middle three facets (from left to right).

bottomRow :: Lens' (Side a) (Vec3 a) Source

The bottom three facets (from left to right).

leftCol :: Lens' (Side a) (Vec3 a) Source

The left column (from top to down).

centerCol :: Lens' (Side a) (Vec3 a) Source

The center column (from top to down).

rightCol :: Lens' (Side a) (Vec3 a) Source

The right column (from top to down).

Traversing facets

By layer

topLayerFacets :: Traversal' (RubiksCube a) a Source

The 21=4*3+9 facets in the top layer.

middleLayerFacets :: Traversal' (RubiksCube a) a Source

The 12=4*3 facets in the middle layer.

bottomLayerFacets :: Traversal' (RubiksCube a) a Source

The 21=4*3+9 facets in the bottom layer.

By position

centerFacets :: Traversal' (RubiksCube a) a Source

The six facets that are the center of their side.

cornerFacets :: Traversal' (RubiksCube a) a Source

The 24=6*4=8*3 corner facets.

edgeFacets :: Traversal' (RubiksCube a) a Source

The 24=6*4=12*2 edge facets.

Rotating the whole cube

type Aut a = Iso' a a Source

The type of automorphisms

rotateLeft :: Aut (RubiksCube a) Source

Rotate the whole Rubik's Cube such that the front side becomes the new left side and the top and bottom sides stay fixed.

rotateRight :: Aut (RubiksCube a) Source

Rotate the whole Rubik's Cube such that the front side becomes the new right side and the top and bottom sides stay fixed.

rotateDown :: Aut (RubiksCube a) Source

Rotate the whole Rubik's Cube such that the front side becomes the new bottom side and the left and right sides stay fixed.

rotateUp :: Aut (RubiksCube a) Source

Rotate the whole Rubik's Cube such that the front side becomes the new top side and the left and right sides stay fixed.

rotateCW :: Aut (RubiksCube a) Source

Rotate the whole Rubik's Cube such that the top side becomes the new right side and the front and back sides stay fixed.

rotateCCW :: Aut (RubiksCube a) Source

Rotate the whole Rubik's Cube such that the top side becomes the new left side and the front and back sides stay fixed.

Moving layers of the cube

move :: Move -> Aut (RubiksCube a) Source

Perform a move.

doMoves :: [Move] -> Aut (RubiksCube a) Source

Perform a list of moves.

undoMoves :: [Move] -> Aut (RubiksCube a) Source

Undo the actions of a list of moves.