Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------------------------------------------------------------------------------------------
- ---CROSS
- makeTopCorss:: RubixCube -> [Command]
- makeTopCorss (RubixCube rs) | checkCross rs == True = []
- | checkCross rs == False = commands ++ (makeTopCorss (computeCommandList (RubixCube rs) commands))
- where commands = let f = (rs !! 0) in
- let l = (rs !! 1) in
- let r = (rs !! 2) in
- let u = (rs !! 3) in
- let d = (rs !! 4) in
- let b = (rs !! 5) in
- let colour = u !! 4 in
- if (f !! 3) == colour then
- if (u !! 3) /= colour then [LI] else
- if (u !! 7) /= colour then [U,LI] else
- if (u !! 1) /= colour then [UI,LI] else
- if (u !! 5) /= colour then [U,U,LI] else []
- else
- if (f !! 5) == colour then
- if (u !! 5) /= colour then [R] else
- if (u !! 7) /= colour then [UI,R] else
- if (u !! 1) /= colour then [U,R] else
- if (u !! 3) /= colour then [U,U,R] else []
- else
- if (f !! 1) == colour then
- if (u !! 5) /= colour then [F,R] else
- if (u !! 3) /= colour then [FI,LI] else
- if (u !! 1) /= colour then [F,U,R] else
- if (u !! 7) /= colour then [F,RI,DI,R,FI,FI] else []
- else
- if (f !! 7) == colour then
- if (u !! 5) /= colour then [FI,R] else
- if (u !! 3) /= colour then [F,LI] else
- if (u !! 1) /= colour then [FI,U,R] else
- if (u !! 7) /= colour then [FI,RI,DI,R,FI,FI] else []
- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
- else
- if (l !! 3) == colour then
- if (u !! 1) /= colour then [BI] else
- if (u !! 3) /= colour then [U,BI] else
- if (u !! 5) /= colour then [UI,BI] else
- if (u !! 7) /= colour then [U,U,BI] else []
- else
- if (l !! 5) == colour then
- if (u !! 7) /= colour then [F] else
- if (u !! 3) /= colour then [UI,F] else
- if (u !! 5) /= colour then [U,F] else
- if (u !! 1) /= colour then [U,U,F] else []
- else
- if (l !! 1) == colour then
- if (u !! 7) /= colour then [L,F] else
- if (u !! 1) /= colour then [LI,BI] else
- if (u !! 5) /= colour then [L,U,F] else
- if (u !! 3) /= colour then [L,FI,DI,F,LI,LI] else []
- else
- if (l !! 7) == colour then
- if (u !! 7) /= colour then [LI,F] else
- if (u !! 1) /= colour then [L,BI] else
- if (u !! 5) /= colour then [LI,U,F] else
- if (u !! 3) /= colour then [LI,FI,DI,F,LI,LI] else []
- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
- else
- if (r !! 3) == colour then
- if (u !! 7) /= colour then [FI] else
- if (u !! 5) /= colour then [U,FI] else
- if (u !! 3) /= colour then [UI,FI] else
- if (u !! 1) /= colour then [U,U,FI] else []
- else
- if (r !! 5) == colour then
- if (u !! 1) /= colour then [B] else
- if (u !! 5) /= colour then [UI,B] else
- if (u !! 3) /= colour then [U,B] else
- if (u !! 7) /= colour then [U,U,B] else []
- else
- if (r !! 1) == colour then
- if (u !! 1) /= colour then [R,B] else
- if (u !! 7) /= colour then [RI,FI] else
- if (u !! 3) /= colour then [R,U,B] else
- if (u !! 5) /= colour then [R,BI,DI,B,RI,RI] else []
- else
- if (r !! 7) == colour then
- if (u !! 1) /= colour then [RI,B] else
- if (u !! 7) /= colour then [R,FI] else
- if (u !! 3) /= colour then [RI,U,B] else
- if (u !! 5) /= colour then [RI,BI,DI,B,RI,RI] else []
- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- else
- if (b !! 3) == colour then
- if (u !! 5) /= colour then [RI] else
- if (u !! 1) /= colour then [U,RI] else
- if (u !! 7) /= colour then [UI,RI] else
- if (u !! 3) /= colour then [U,U,RI] else []
- else
- if (b !! 5) == colour then
- if (u !! 3) /= colour then [L] else
- if (u !! 1) /= colour then [UI,L] else
- if (u !! 7) /= colour then [U,L] else
- if (u !! 5) /= colour then [U,U,L] else []
- else
- if (b !! 1) == colour then
- if (u !! 3) /= colour then [B,L] else
- if (u !! 5) /= colour then [BI,RI] else
- if (u !! 7) /= colour then [B,U,L] else
- if (u !! 1) /= colour then [B,LI,DI,L,BI,BI] else []
- else
- if (b !! 7) == colour then
- if (u !! 3) /= colour then [BI,L] else
- if (u !! 5) /= colour then [B,RI] else
- if (u !! 7) /= colour then [BI,U,L] else
- if (u !! 1) /= colour then [BI,LI,DI,L,BI,BI] else []
- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- else
- if (d !! 3) == colour then
- if (u !! 3) /= colour then [LI,LI] else
- if (u !! 7) /= colour then [U,LI,LI] else
- if (u !! 1) /= colour then [UI,LI,LI] else
- if (u !! 5) /= colour then [U,U,LI,LI] else []
- else
- if (d !! 5) == colour then
- if (u !! 5) /= colour then [R,R] else
- if (u !! 7) /= colour then [UI,R,R] else
- if (u !! 1) /= colour then [U,R,R] else
- if (u !! 3) /= colour then [U,U,R,R] else []
- else
- if (d !! 1) == colour then
- if (u !! 5) /= colour then [D,R,R] else
- if (u !! 3) /= colour then [DI,LI,LI] else
- if (u !! 1) /= colour then [D,U,R,R] else
- if (u !! 7) /= colour then [U,DI,L,L] else []
- else
- if (d !! 7) == colour then
- if (u !! 5) /= colour then [DI,R,R] else
- if (u !! 3) /= colour then [D,L,L] else
- if (u !! 1) /= colour then [B,B] else
- if (u !! 7) /= colour then [D,U,L,L] else []
- else []
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement