What is Rubik’s Cube?
Abstract
In this blog post we are going to see, a complex opengl project to show and solve the puzzele of Rubik’s Cube in OpenGL C++.
The cubies are divided into three different types:
Centre Cubies:
The center cubies refer to the cubie pieces that are located at the center of each face of the Rubik’s cube. There is a total of six cubies, and each has one facelet, they always stick in the same location corresponding to each other.
Corner Cubies:
The corner cubies refer to the cubic pieces that are located at the corner of the Rubik’s cube. There is a total of eight corners, and each has three facelets.
Edge Cubies:
The edge cubies refer to the edge pieces that are located between each pair of the corresponding corners. There are 12 different edges in the Rubik’s cube, and each has two Facelets.
All cubes do not have the same color arrangements. The colors utilized for these illustrations is known as BOY (Blue, Orange, and Yellow, are faced in the clockwise direction). Here, you need to analyze the locations of the centers corresponding to each other, as this is always your color arrangements.
White is located opposite to yellow.
Blue is located opposite to green.
Orange is located opposite red.
Orange is also located to the right of blue only if white is facing up.
User Interaction
1. The interaction between the windowing system and OPENGL is initiated.
We initialize the window size and window position.
2. Display function is called where the functions and operations for the
Rubiks cube are defined.
3. Using the left mouse button the cube can be rotated along the
required axis.
4. Using the right mouse button menus can be viewed, by selecting the
options from the menu the required face of the cube can be rotated either
clockwise or anti-clockwise.
5. The rotation of faces of the cube can also be done using keys from the
keyboard.
6. Press the key ‘a’ to rotate the top face of the cube in the clockwise direction.
7. Press the key ‘q’ to rotate the top face of the cube in the anti-clockwise
direction.
8. Press the key ‘s’ to rotate the right face of the cube in the clockwise
direction.
9. Press the key ‘w’ to rotate the right face of the cube in the anti-clockwise
direction.
10. Press the key ‘d’ to rotate the front face of the cube in the clockwise
direction.
11. Press the key ‘e’ to rotate the front face of the cube in the anti-clockwise
direction.
12. Press the key ‘f’ to rotate the left face of the cube in the clockwise direction.
13. Press the key ‘r’ to rotate the left face of the cube in the anti-clockwise
direction.
14. Press the key ‘g’ to rotate the back face of the cube in the clockwise
direction.
15. Press the key ‘t’ to rotate the back face of the cube in the anti-clockwise
direction.
16. Press the key ‘h’ to rotate the bottom face of the cube in the clockwise
direction.
17. Press the key ‘y’ to rotate the bottom face of the cube in the anti-clockwise
direction.
19. Press the key ‘o’ for the automatic solving.
20. Press the keys ‘m’ and ‘n’ to control the speed of rotation.
21. Use the keys ‘1’,’2’,’4’,’5’,’6’,’8’,’9’ to rotate the cube along different axes.
Screen Shots
Source Code
Want Source code write a email to us at [email protected]