twentyseven-0.0.0: Rubik's cube solver

Safe HaskellNone
LanguageHaskell2010

Rubik.Cube.Moves

Contents

Description

Move and cube definitions

Synopsis

Documentation

newtype MoveTag m a Source

Constructors

MoveTag 

Fields

unMoveTag :: a
 

Instances

Functor (MoveTag m) Source 
Eq a => Eq (MoveTag m a) Source 
Ord a => Ord (MoveTag m a) Source 
Show a => Show (MoveTag m a) Source 
NFData a => NFData (MoveTag m a) Source 
Binary a => Binary (MoveTag m a) Source 
Newtype (MoveTag m a) a Source 

Generating moves

r :: Cube Source

Right

f :: Cube Source

Front

d :: Cube Source

Down

l :: Cube Source

Left

b :: Cube Source

Back

move6 :: [Cube] Source

List of the 6 generating moves.

move6 = [u,l,f,r,b,d]

18 elementary moves

move18Names :: MoveTag Move18 [ElemMove] Source

Associate every elementary move with an ElemMove.

move18 :: MoveTag Move18 [Cube] Source

List of the 18 elementary moves.

move18 = [u, u <>^ 2, u <>^ 3, ...]

Other subgroups

move10 :: MoveTag Move10 [Cube] Source

G1 = <U, D, L2, F2, R2, B2>

move6' :: [Cube] Source

Generating set of G1

Symmetries

surf3 :: Cube Source

Rotation of the whole cube around the diagonal axis through corners URF and LBD

sf2 :: Cube Source

Half-turn of the whole cube around the FB axis

su4 :: Cube Source

Quarter-turn around the UD axis

slr2 :: Cube Source

Reflection w.r.t. the RL slice plane

data Symmetry sym Source

Constructors

Symmetry 

Fields

symAsCube :: Cube
 
symAsMovePerm :: [Int]
 

data Symmetric sym a Source

rawMoveSym :: Symmetry sym -> [a] -> [a] Source

newtype SymCode s Source

Index of a symmetry

Constructors

SymCode 

Fields

unSymCode :: Int
 

Instances

symDecode :: SymCode s -> Cube Source

Translate an integer to a symmetry.

sym16Codes :: [SymCode UDFix] Source

Symmetries which preserve the UD axis (generated by sf2, su4 and slr2)

sym48Codes :: [SymCode CubeSyms] Source

All symmetries of the whole cube

composeSym :: SymCode sym -> SymCode sym -> SymCode sym Source

Random cube/move

randomCube :: MonadRandom m => m Cube Source

Generate a random solvable Cube.

Relies on randomRIO.

Move algebra

oppositeAndGT :: BasicMove -> BasicMove -> Bool Source

Relation between faces

oppositeAndGT X Y == True if X and Y are opposite faces and X > Y.

type ElemMove = (Int, BasicMove) Source

Quarter turns, clock- and anti-clockwise, half turns

type Move = [ElemMove] Source

Moves generated by BasicMove, group-ed

reduceMove :: Move -> Move Source

Perform "trivial" reductions of the move sequence.

nubMove :: [Move] -> [Move] Source

Remove moves that result in duplicate actions on the Rubik's cube

Conversions

moveToCube :: Move -> Cube Source

Scramble the solved cube.

moveToString :: Move -> String Source

Show the move sequence.

stringToMove :: String -> Either Char Move Source

Reads a space-free sequence of moves. If the string is incorrectly formatted, the first wrong character is returned.

([ulfrbd][23']?)*