Safe Haskell | None |
---|---|
Language | Haskell2010 |
- numFacelets :: Int
- newtype Facelets = Facelets {}
- fromFacelets' :: Facelets -> [Int]
- facelets' :: [Int] -> Maybe Facelets
- facelets :: Vector Int -> Maybe Facelets
- unsafeFacelets :: Vector Int -> Facelets
- unsafeFacelets' :: [Int] -> Facelets
- type Color = Int
- newtype ColorFacelets = ColorFacelets {}
- fromColorFacelets' :: ColorFacelets -> [Color]
- colorFacelets' :: [Color] -> Maybe ColorFacelets
- colorFacelets :: Vector Color -> Maybe ColorFacelets
- colorOf :: Int -> Color
- colorFaceletsOf :: Facelets -> ColorFacelets
- colorChar :: Color -> Char
- stringOfFacelets :: Facelets -> String
- stringOfColorFacelets :: ColorFacelets -> String
- stringOfColorFacelets' :: Facelets -> String
- colorFacelets'' :: Eq a => [a] -> Maybe ColorFacelets
- centerFacelets :: [Int]
- ulb :: [Int]
- ufl :: [Int]
- urf :: [Int]
- ubr :: [Int]
- dlf :: [Int]
- dfr :: [Int]
- drb :: [Int]
- dbl :: [Int]
- cornerFacelets :: [[Int]]
- ul :: [Int]
- uf :: [Int]
- ur :: [Int]
- ub :: [Int]
- dl :: [Int]
- df :: [Int]
- dr :: [Int]
- db :: [Int]
- fl :: [Int]
- fr :: [Int]
- bl :: [Int]
- br :: [Int]
- edgeFacelets :: [[Int]]
Documentation
numFacelets :: Int Source
There are 54 == 6 * 9
facelets.
Cube as a permutation of facelets (replaced-by).
Every facelet is represented as an Int
in [0 .. 54]
.
fromFacelets' :: Facelets -> [Int] Source
See fromFacelets'
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
unsafeFacelets' :: [Int] -> Facelets Source
newtype ColorFacelets Source
Cube as a list of facelet colors.
fromColorFacelets' :: ColorFacelets -> [Color] Source
See fromColorFacelets
.
colorFacelets' :: [Color] -> Maybe ColorFacelets Source
See colorFacelets
.
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.
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
cornerFacelets :: [[Int]] Source
cornerFacelets = [ulb, ufl, urf, ubr, dlf, dfr, drb, dbl]
edgeFacelets :: [[Int]] Source
edgeFacelets = [ul, uf, ur, ub, dl, df, dr, db, fl, fr, bl, br]