hcube-0.1.0: HCube/Permutation.hs
-----------------------------------------------------------------------------
-- |
-- Module : HCube.Permutation
-- Copyright : (c) Todd Wegner 2013
-- License : BSD-style (see the LICENSE file)
--
-- Maintainer : todd.w.wegner@gmail.com
-- Stability : provisional
-- Portability : portable
--
-- Generation of permutation representation of cube.
-----------------------------------------------------------------------------
module HCube.Permutation (genPerm) where
import Math.Algebra.Group.PermutationGroup (Permutation, fromPairs')
import HCube.Lib
import HCube.Data
-- | Map a cube operation to an element of the permutation group.
genPerm :: Size -> (Rubik -> [Cube]) -> Rotation -> Permutation Numb
genPerm sz fn rt = fromPairs' . g $ doCubeOps [rt] f where
f = initCube sz
g rb = map h $ fn rb
h (Cube ps or ci) = (ci, posToId sz ps)
-- [crn, edg, cnt, hid]
{-
all = map f [crn, edg, cnt, hid] where
f fu = genPerm 3 fu (Rotation Layer Clockwise 3)
l = genPerm 3 edg (Rotation Layer Clockwise 3)
ll = genPerm2 3 edg (Rotation Layer Clockwise 3)
lll = toPairs l
m = genPerm 3 edg (Rotation HSlice Clockwise 3)
n = supp m
-}