module HCube.Data where
type Numb = Int
type Size = Numb
type Point = (Numb, Numb)
type Vec = (Numb, Numb, Numb)
type Format = String
type ColorTag = String
type Projection = [(Numb,Side)]
type CubeSurf = [(Side,[Color])]
data Matrix = Matrix Vec Vec Vec deriving Show
data Command = Projection View |
Operation [Rotation] |
Undo |
Help |
Quit |
NoCommand
data View = LeftV |
RightV deriving (Show, Read, Eq)
data ViewAssociation = Sur (Numb,Side) |
Ide Numb |
Ori Numb
data Rotation = Rotation Slab Direction Numb |
RotateCube Slab Direction
deriving (Show, Read,Eq)
data Direction = Clockwise | Counter | Twice | NoDir deriving (Show, Read,Eq)
data Slab = Layer | HSlice | VSlice | NoSlab deriving (Show, Read, Eq)
data Side = UpS | DownS | FrontS | BackS | LeftS | RightS | NoSide
deriving (Show, Read, Eq, Ord)
data Color = White | Yellow | Orange | Red | Blue | Green | NoColor
deriving (Read, Eq)
instance Show Color where
show White = whiteC
show Yellow = yellowC
show Orange = orangeC
show Red = redC
show Blue = blueC
show Green = greenC
show NoColor = ""
data ActualCube = ActualCube {
up :: Color,
front :: Color,
down :: Color,
back :: Color,
left :: Color,
right :: Color
} deriving (Show, Read, Eq)
whiteC = "W"
yellowC = "Y"
orangeC = "O"
redC = "R"
blueC = "B"
greenC = "G"
noC = "-"
invOpp :: Rotation -> Rotation
invOpp (Rotation sb dir nm) = Rotation sb (invDir dir) nm
invOpp (RotateCube sb dir) = RotateCube sb (invDir dir)
invDir :: Direction -> Direction
invDir Clockwise = Counter
invDir Counter = Clockwise
invDir Twice = Twice
sideToColor :: Side -> Color
sideToColor UpS = White
sideToColor DownS = Yellow
sideToColor FrontS = Orange
sideToColor BackS = Red
sideToColor LeftS = Green
sideToColor RightS = Blue
sideToColor NoSide = NoColor
colorToSide :: Color -> Side
colorToSide White = UpS
colorToSide Yellow = DownS
colorToSide Orange = FrontS
colorToSide Red = BackS
colorToSide Blue = RightS
colorToSide Green = LeftS
colorToSide NoColor = NoSide