twentyseven-0.0.0: Rubik's cube solver

Safe HaskellNone
LanguageHaskell2010

Rubik.Solver

Synopsis

Documentation

data Projection x a0 as a Source

Constructors

Projection 

Fields

convertP :: x -> a
 
isIdenP :: a -> Bool
 
indexP :: as -> a -> a
 
subIndexSize :: Int
 
unfoldP :: a0 -> SubIndex -> [as]
 
subIndexP :: a -> SubIndex
 

type SymProjection m sym a = Projection Cube (MoveTag m [SymMove sym a]) (SymMove sym a) (SymCoord sym a) Source

newtype Distance m a Source

Constructors

Distance 

Fields

distanceP :: a -> DInt
 

(|*|) :: (TupleCons b0, TupleCons bs, TupleCons b) => Projection x a0 as a -> Projection x b0 bs b -> Projection x (a0 :| b0) (as :| bs) (a :| b) infixr 4 Source

(|.|) :: forall x a0 as a b0 bs b. Projection x a0 as a -> Projection x b0 bs b -> Projection x (a0, b0) (as, bs) (a, b) infixr 4 Source

(>$<) :: forall m a b. (b -> a) -> Distance m a -> Distance m b Source

maxDistance :: forall f m a. Foldable f => f (Distance m a) -> Distance m a Source

solveWith :: Eq a => MoveTag m [ElemMove] -> a0 -> Projection Cube a0 as a -> Distance m a -> Cube -> Move Source

Branching reduction

The Int projection keeps track of the latest move (== 6 for the starting point).

18 moves

We can indeed reduce the branching factor from 18 to 15 by considering that successive moves on the same face can and will be shortened as a single move.

Furthermore, since moves on opposite faces commute, we may force them to be in an arbitrary order, reducing the branching factor to 12 after half of the moves (U, L, F).

10 moves

Instead of a factor 10, we have factors

  • 9 after R, B;
  • 8 after L, F;
  • 7 after D;
  • 4 after U.

type Tag a = (Int, a) Source

tag :: a -> Tag a Source

symProjection :: (FromCube a, RawEncodable a) => (a -> SymCoord sym a) -> SymProjection m sym a Source

symmetricProj :: Eq c => Symmetry sym -> Projection Cube (MoveTag m [b]) as c -> Projection Cube (MoveTag m [b]) as c Source