Advertisement
Guest User

new

a guest
Jan 20th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.31 KB | None | 0 0
  1. ------------------------------------------------------------------------------------------------------------------
  2. ---CROSS
  3. makeTopCorss:: RubixCube -> [Command]
  4. makeTopCorss (RubixCube rs) | checkCross rs == True = []
  5. | checkCross rs == False = commands ++ (makeTopCorss (computeCommandList (RubixCube rs) commands))
  6. where commands = let f = (rs !! 0) in
  7. let l = (rs !! 1) in
  8. let r = (rs !! 2) in
  9. let u = (rs !! 3) in
  10. let d = (rs !! 4) in
  11. let b = (rs !! 5) in
  12. let colour = u !! 4 in
  13. if (f !! 3) == colour then
  14. if (u !! 3) /= colour then [LI] else
  15. if (u !! 7) /= colour then [U,LI] else
  16. if (u !! 1) /= colour then [UI,LI] else
  17. if (u !! 5) /= colour then [U,U,LI] else []
  18. else
  19. if (f !! 5) == colour then
  20. if (u !! 5) /= colour then [R] else
  21. if (u !! 7) /= colour then [UI,R] else
  22. if (u !! 1) /= colour then [U,R] else
  23. if (u !! 3) /= colour then [U,U,R] else []
  24. else
  25. if (f !! 1) == colour then
  26. if (u !! 5) /= colour then [F,R] else
  27. if (u !! 3) /= colour then [FI,LI] else
  28. if (u !! 1) /= colour then [F,U,R] else
  29. if (u !! 7) /= colour then [F,RI,DI,R,FI,FI] else []
  30. else
  31. if (f !! 7) == colour then
  32. if (u !! 5) /= colour then [FI,R] else
  33. if (u !! 3) /= colour then [F,LI] else
  34. if (u !! 1) /= colour then [FI,U,R] else
  35. if (u !! 7) /= colour then [FI,RI,DI,R,FI,FI] else []
  36. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
  37. else
  38. if (l !! 3) == colour then
  39. if (u !! 1) /= colour then [BI] else
  40. if (u !! 3) /= colour then [U,BI] else
  41. if (u !! 5) /= colour then [UI,BI] else
  42. if (u !! 7) /= colour then [U,U,BI] else []
  43. else
  44. if (l !! 5) == colour then
  45. if (u !! 7) /= colour then [F] else
  46. if (u !! 3) /= colour then [UI,F] else
  47. if (u !! 5) /= colour then [U,F] else
  48. if (u !! 1) /= colour then [U,U,F] else []
  49. else
  50. if (l !! 1) == colour then
  51. if (u !! 7) /= colour then [L,F] else
  52. if (u !! 1) /= colour then [LI,BI] else
  53. if (u !! 5) /= colour then [L,U,F] else
  54. if (u !! 3) /= colour then [L,FI,DI,F,LI,LI] else []
  55. else
  56. if (l !! 7) == colour then
  57. if (u !! 7) /= colour then [LI,F] else
  58. if (u !! 1) /= colour then [L,BI] else
  59. if (u !! 5) /= colour then [LI,U,F] else
  60. if (u !! 3) /= colour then [LI,FI,DI,F,LI,LI] else []
  61. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
  62. else
  63. if (r !! 3) == colour then
  64. if (u !! 7) /= colour then [FI] else
  65. if (u !! 5) /= colour then [U,FI] else
  66. if (u !! 3) /= colour then [UI,FI] else
  67. if (u !! 1) /= colour then [U,U,FI] else []
  68. else
  69. if (r !! 5) == colour then
  70. if (u !! 1) /= colour then [B] else
  71. if (u !! 5) /= colour then [UI,B] else
  72. if (u !! 3) /= colour then [U,B] else
  73. if (u !! 7) /= colour then [U,U,B] else []
  74. else
  75. if (r !! 1) == colour then
  76. if (u !! 1) /= colour then [R,B] else
  77. if (u !! 7) /= colour then [RI,FI] else
  78. if (u !! 3) /= colour then [R,U,B] else
  79. if (u !! 5) /= colour then [R,BI,DI,B,RI,RI] else []
  80. else
  81. if (r !! 7) == colour then
  82. if (u !! 1) /= colour then [RI,B] else
  83. if (u !! 7) /= colour then [R,FI] else
  84. if (u !! 3) /= colour then [RI,U,B] else
  85. if (u !! 5) /= colour then [RI,BI,DI,B,RI,RI] else []
  86. --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  87. else
  88. if (b !! 3) == colour then
  89. if (u !! 5) /= colour then [RI] else
  90. if (u !! 1) /= colour then [U,RI] else
  91. if (u !! 7) /= colour then [UI,RI] else
  92. if (u !! 3) /= colour then [U,U,RI] else []
  93. else
  94. if (b !! 5) == colour then
  95. if (u !! 3) /= colour then [L] else
  96. if (u !! 1) /= colour then [UI,L] else
  97. if (u !! 7) /= colour then [U,L] else
  98. if (u !! 5) /= colour then [U,U,L] else []
  99. else
  100. if (b !! 1) == colour then
  101. if (u !! 3) /= colour then [B,L] else
  102. if (u !! 5) /= colour then [BI,RI] else
  103. if (u !! 7) /= colour then [B,U,L] else
  104. if (u !! 1) /= colour then [B,LI,DI,L,BI,BI] else []
  105. else
  106. if (b !! 7) == colour then
  107. if (u !! 3) /= colour then [BI,L] else
  108. if (u !! 5) /= colour then [B,RI] else
  109. if (u !! 7) /= colour then [BI,U,L] else
  110. if (u !! 1) /= colour then [BI,LI,DI,L,BI,BI] else []
  111. --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  112. else
  113. if (d !! 3) == colour then
  114. if (u !! 3) /= colour then [LI,LI] else
  115. if (u !! 7) /= colour then [U,LI,LI] else
  116. if (u !! 1) /= colour then [UI,LI,LI] else
  117. if (u !! 5) /= colour then [U,U,LI,LI] else []
  118. else
  119. if (d !! 5) == colour then
  120. if (u !! 5) /= colour then [R,R] else
  121. if (u !! 7) /= colour then [UI,R,R] else
  122. if (u !! 1) /= colour then [U,R,R] else
  123. if (u !! 3) /= colour then [U,U,R,R] else []
  124. else
  125. if (d !! 1) == colour then
  126. if (u !! 5) /= colour then [D,R,R] else
  127. if (u !! 3) /= colour then [DI,LI,LI] else
  128. if (u !! 1) /= colour then [D,U,R,R] else
  129. if (u !! 7) /= colour then [U,DI,L,L] else []
  130. else
  131. if (d !! 7) == colour then
  132. if (u !! 5) /= colour then [DI,R,R] else
  133. if (u !! 3) /= colour then [D,L,L] else
  134. if (u !! 1) /= colour then [B,B] else
  135. if (u !! 7) /= colour then [D,U,L,L] else []
  136. else []
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement