hcube-0.1.1: Virtual Rubik's cube of arbitrary size.

Portabilityportable
Stabilityprovisional
Maintainerechbar137@yahoo.co.in
Safe HaskellSafe

HCube.Lib

Description

Exposes virtual cube functionality.

Synopsis

Documentation

data Rubik Source

Vitrual Rubik's cube.

Constructors

Rubik 

Fields

n :: Size
 
crn :: [Cube]
 
edg :: [Cube]
 
cnt :: [Cube]
 
hid :: [Cube]
 
loop :: Bool
 
view :: View
 
his :: [Rotation]
 

Instances

data Cube Source

Individual cube of Rubik's cube, known as a Cubie.

Constructors

Cube 

Fields

pos :: Vec
 
ori :: Orient
 
cid :: Numb
 

Instances

posToId :: Size -> Vec -> NumbSource

Converts a pseudo-vector representation to a cube id.

getPos :: Size -> Numb -> VecSource

Converts a cube id to a pseudo-vector representation.

consCubeInfo :: Int -> CubeSurf -> [(Int, ActualCube, ColorTag)]Source

Converts from a surface view of cube to a cubie view of cube.

solvedSurf :: Int -> CubeSurfSource

CubeSurf representing a solved cube.

cubeIdsOfFace :: Int -> Side -> [Int]Source

Maps a face id defined with respect to a side, to the cube id.

cubeTypes :: Size -> ([Int], [Int], [Int], [Int])Source

Generates a tuple of cube ids corresponding to (corners, edges, centers, hidden cubies).

initCube :: Size -> RubikSource

Creates a virtual cube in solved state

getFaceColor :: Rubik -> (Numb, Side) -> StringSource

Color of cube id on a face is returned. This function is important for rendering.

getCubeFromPos :: Rubik -> Numb -> CubeSource

Returns the cubie at a given position.

doCubeOps :: [Rotation] -> Rubik -> RubikSource

Performs a cube operation on virtual cube. Conceptually this corresponds to multiplying the cube state by an appropriate element of the permutation group. However a vector approach is used here.

loadCube :: Size -> FilePath -> IO RubikSource

Loads cube from a file.

saveCube :: FilePath -> Rubik -> IO ()Source

Saves cube to a file.