twentyseven-0.0.0: Rubik's cube solver

Safe HaskellNone
LanguageHaskell2010

Rubik.Cube.Facelet.Internal

Synopsis

Documentation

numFacelets :: Int Source

There are 54 == 6 * 9 facelets.

newtype Facelets Source

Cube as a permutation of facelets (replaced-by).

Every facelet is represented as an Int in [0 .. 54].

Constructors

Facelets 

Fields

fromFacelets :: Vector Int

The underlying Vector of Int.

facelets :: Vector Int -> Maybe Facelets Source

This constructor checks that the input is a permutation of '[0 .. 53]'.

unsafeFacelets :: Vector Int -> Facelets Source

Constructor with no safety checks

type Color = Int Source

The standard cube colors are the values between 0 and 5.

newtype ColorFacelets Source

Cube as a list of facelet colors.

Constructors

ColorFacelets 

Fields

fromColorFacelets :: Vector Color

The underlying Vector of Color.

colorFacelets :: Vector Color -> Maybe ColorFacelets Source

This constructor checks that only standard colors (in [0 .. 5]) are used, that the argument has length 54 and that the centers are colored in order.

Note that there may still be more or less than 9 colors of a kind, although that cannot be the case in an actual cube.

colorOf :: Int -> Color Source

The color of a facelet given its identifier.

colorFaceletsOf :: Facelets -> ColorFacelets Source

Remove permutation information.

If the argument cube can be obtained from the solved cube with the usual moves, then the original permutation can be recovered with colorFaceletsToCube.

colorChar :: Color -> Char Source

A color is mapped to a face, indicated by a Char:

map colorChar [0..5] == "ULFRBD"

stringOfFacelets :: Facelets -> String Source

String listing the permutation of facelets numbered in base 9.

Base 9 is convenient here because the first digit directly corresponds to a face and the second to the facelet position in that face.

stringOfColorFacelets :: ColorFacelets -> String Source

String listing the facelet colors.

stringOfColorFacelets' :: Facelets -> String Source

Only show the colors of the facelets.

colorFacelets'' :: Eq a => [a] -> Maybe ColorFacelets Source

Convert a 6-color list of length 54 in any representation which implements Eq to ColorFacelets.

centerFacelets :: [Int] Source

  centerFacelets
  = [ 4,  -- U
      13, -- L
      22, -- F
      31, -- R
      40, -- B
      49] -- D

ulb :: [Int] Source

Corner facelets

ufl :: [Int] Source

Corner facelets

urf :: [Int] Source

Corner facelets

ubr :: [Int] Source

Corner facelets

dlf :: [Int] Source

Corner facelets

dfr :: [Int] Source

Corner facelets

drb :: [Int] Source

Corner facelets

dbl :: [Int] Source

Corner facelets

cornerFacelets :: [[Int]] Source

cornerFacelets = [ulb, ufl, urf, ubr, dlf, dfr, drb, dbl]

ul :: [Int] Source

Edge facelets

uf :: [Int] Source

Edge facelets

ur :: [Int] Source

Edge facelets

ub :: [Int] Source

Edge facelets

dl :: [Int] Source

Edge facelets

df :: [Int] Source

Edge facelets

dr :: [Int] Source

Edge facelets

db :: [Int] Source

Edge facelets

fl :: [Int] Source

Edge facelets

fr :: [Int] Source

Edge facelets

bl :: [Int] Source

Edge facelets

br :: [Int] Source

Edge facelets

edgeFacelets :: [[Int]] Source

edgeFacelets = [ul, uf, ur, ub, dl, df, dr, db, fl, fr, bl, br]