----------------------------------------------------------------------------- -- | -- Module : HCube.Permutation -- Copyright : (c) Todd Wegner 2012 -- License : BSD-style (see the LICENSE file) -- -- Maintainer : echbar137@yahoo.co.in -- Stability : provisional -- Portability : portable -- -- Generation of permutation representation of cube. ----------------------------------------------------------------------------- {-# LANGUAGE Trustworthy #-} 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 -}