Solving Rubiks Cube Using Open CV
Solving Rubiks Cube Using Open CV
https://doi.org/10.22214/ijraset.2022.44674
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue VI June 2022- Available at www.ijraset.com
Abstract: The Rubik’s cube is 3D combinatorial and mechanical puzzle invented in 1974. It challenged users to solve colourful
puzzle in record time. We use OPEN CV to solve this Rubik’s Cube. We will recognize the scrambled state of the cube. Then will
implement an algorithm that takes input as scrambled state of the cube and outputs a sequence of moves that solves the cube. In
order to recognize colours on each faces of the cube and then applying various algorithms on it in order to solve the Rubik’s
Cube.
Keywords: Kociemba, OpenCV, Contour, NumPy
I. INTRODUCTION
1) The most vital a part of solving a Rubik's Cube is knowing how it works Rubik's cube is one in every of the foremost
challenging and most famous puzzles of all time.
2) It continues to stay within the top among the puzzle games thanks to the look of the puzzle i.e. one correct solution out of the 43
quintillion other possibilities
3) Only 5.8% of world population can solve the Rubik's cube efficiently. But Al& ML concept is ready to try and do with
minimum number of moves.
4) There are three major parts to solve any Rubik'sCube First is identifying the positions of various colours at different positions.
5) Second is to develop a series of steps which may be wont to solve the cube and third is to implement these steps on the cube to
induce the ultimate result
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 3470
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue VI June 2022- Available at www.ijraset.com
OpenCV which is used for detecting the blobs. Koceimba’s algorithm: After finding the matrix that stores the colors of the
individual blocks of the six faces of the cube, an algorithm are required which provides the steps that can solve the cube. Arduino
coding.The Arduino is coded in Arduino interface and it provides rotation to each face of the cube. The code ensures that the
grippers do not collide with each other at any point of time while unscrambling the cube.
This Ms. Ekta S. Toshniwal, Mr. Yogesh Golhar [3] paper has Thistlethwaite’s algorithm: The Thistlewaite Algorithm was the least
effective method of solving the Rubik’s cube requiring an average of 42 moves and 3 mins and 48 seconds. This method was found
to be not too much effective and useful. Kociemba’s Algorithm: Kociemba’s Algorithm was an improvement on Thistlethwaite’s
algorithm. The Kociemba’s algorithm proved to be the 2nd most effective algorithm, requiring an average of 28 moves and 2 mins
and 32 seconds.d
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 3471
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue VI June 2022- Available at www.ijraset.com
A. Algorithm
Kociemba’s algorithm performs much more better than Thistlethwaite’s as it reduces the quantity of phase transitions to only 2
rather than 4 this implies that transition must be applied between 3 groups:
G0 = hU, D, R, L, F, Bi.
G1 = hU, D, R2, L2, F2, B2i
G2 = {C}
Group G0
G0 is that the group of all states reachable using moves L,R,F,B,U,D. Notice how this is often just all reachable states using any of
the legal moves defined in section 2.1.3 since we are able to perform any L2,R2,F2, etc moves by changing L * L , R * R, F *
F. Similarly we are able to perform any L3, R3, F3, by changing moves L * L * L, R * R * R, F * F * F. Our aim is to maneuver
from G0 → G1 → G2 → G3 → G4. Where G4 contains only the solved cube state.
Group G1
G1 is the group of these moves L,R,F,B,U2,D2 to reach all the states .G1 is different to group G0 as all smaller states are
reachable. G1 contains only ‘good’ edges. to work out why this can be so, allow us to recall to our edge flip lemma in section
2.2.1.2. to clarify why there are always an excellent number of flips, we proved that using only moves U, R, D and L, it's out of the
question to flip any edges. rather than moves U, R, D and L, allow us to prove the identical result's possible using moves L, R, F, B,
U2 and D2.
Group G2
The group G2 is simply the solved state. Using only moves in G1 the state is changed directly from G1 → G2.
B. Architecture
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 3472
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue VI June 2022- Available at www.ijraset.com
C. Project Description
1) Face Notation: Usually one labels the faces of a Rubik’s cube using the color of its faces. E.g, For the official international
colour scheme: Red, Blue, Yellow, etc. However, it's more useful to possess a notation that's independent of face colour. this is
often because colour schemes vary from cube to cube. Instead we are able to label the cube using the direction that the face
faces. Assume we've the official Rubik’s cube with international color scheme in an exceedingly position specified the blue
face faces upwards and therefore the white face faces towards ourselves, we will label the faces as follows: F (Front), R (Right),
L (Left), B (Back), U (Up) and D (Down).
Fig. 3
2) Move Notation: Now that we’ve seen a notation that we are able to view to faces, we are able to now define a notation that
defines moves that we are able to perform on the cube. we want two pieces of knowledge to define a move: the face and
therefore the number of 90 degree turns clockwise. For example: R1 could be a 90 degree clockwise turn of the correct face, L2
may be a 180 degree turn of the left face and B3 could be a 270 degree clockwise turn (or a 90 degree anticlockwise turn) of the
rear face.
Fig. 4
3) Rotation Notation: So far, we've got only defined which faces we are able to move. we are able to also express cube rotations
that rotate the full cube. we will define the way to rotate the whole cube by defining the axis of rotations X, Y and Z. If we draw
a line through the R face to the L face as per figure, we define the gyration X as following the clockwise direction turn of the
move R. Similarly, the Y dextrorotation would follow the rotation of U in and Z revolution would follow the rotation of F.
Fig. 5
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 3473
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue VI June 2022- Available at www.ijraset.com
D. System Requirements
1) Hardware Requirements
Processors : More than intel i3
RAM : 4 GB
Storage : 5 GB
Standard Devices : Keyboard, monitor, mouse and camera
2) Software Requirements
Platform : Windows XP/ 7/10/11 /Vista
Language : Python
Simulator : OpenCV
Cloud : Google Colab
IDE/tool : anaconda
V. RESULT ANALYSIS
Fig. 7 Output 1
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 3474
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue VI June 2022- Available at www.ijraset.com
Fig 8 Output 2
Fig.9 Output 3
Fig.10 Output 4
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 3475
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue VI June 2022- Available at www.ijraset.com
Fig.11 Output 5
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 3476
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue VI June 2022- Available at www.ijraset.com
Fig 14 : Output 8
Fig 15 : Output 9
Fig 16 : Output 10
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 3477
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue VI June 2022- Available at www.ijraset.com
Fig 17 : Output 11
Fig 18 : Output 12
VI. CONCLUSIONS
1) The image processing on appropriate estimations can correctly work out the blobs of the cube and hence completely gives the
initial state of the cube. Finally the use of Koceimba’s algorithm gives the solution of the Rubik’s cube which can be finally
used to instruct the users to solve the cube accordingly.
2) A system design for control system is expected to solve Rubik's cube. Using algorithm, open CV and image processing. It helps
the user to solve the scrambled Rubik's cube. The user can effectively solve a Rubik's cube in least number of steps. Rubik's
cube can be solved Without the use of any machine and user solver it with his own hands.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 3478
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue VI June 2022- Available at www.ijraset.com
REFERENCES
[1] D. Zeng, M. Li, J. Wang, Y. Hou, W. Lu and Z. Huang, "Overview of Rubik’s Cube and Reflections on Its Application in Mechanism," Chinese Journal of
Mechanical Engineering, vol. 31, 2018.
[2] E. D. Demaine, M. L. Demaine, S. C. Eisenstat, A. Lubiw and A. Winslow, "Algorithms for Solving Rubik’s Cubes," Algorithms – ESA 2011, vol. 6942, pp.
689-700, 2011.
[3] El-Souranil, N. &. Hauke, S. &. Borschbach and Markus, "An Evolutionary Approach for Solving the Rubik’s CubeIncorporating Exact Methods," Lecture
Notes in Computer Science, vol. 6024, pp. 80- 89, 2010.
[4] S. Saeidi, "Solving the Rubik’s Cube Using Simulated Annealing and Genetic Algorithm," International Journal of Education and Management Engineering,
vol. 8, 2018.
[5] S. P. Rohith, A. M. Sharif, S. Jayasankar and M. Harikrishnan, "Autonomous Rubik’s Cube Solver Bot," International Journal of Scientific Research and
Engineering Development, vol. 2, no. 3,pp. 146-151, 2019.
[6] D. Gilday, "MindCuber," [Online]. Available: http://mindcuber.com. [Accessed 20 November 2020].
[7] J. W. Daryl, "RukuRobot," [Online]. Available: https://rukurobot.weebly.com/. [Accessed 20 November2020].
[8] "3dprint," [Online]. Available: https://3dprint.com/116817/3d-printed- rubikscube-robot/. [Accessed 20 November 2020].
[9] [Online]. Available: https://www.cs.brandeis.edu/~storer/JimPuzzles/RUBIK/Rubik3x3x3/READING/KociembaPage.pdf. [Accessed 21 November 2020]
Rubik's cube solver
[10] S. P. Rohith, A. Mohamed Sharif, S. Jayasankar, M. Harikrishnan “Autonomous Rubik’s Cube Solver Bot” International Journal of Scientific Research and
Engineering Development, Vol.2, Issue 3, (May - June 2019) pp.146-151.
[11] D. Zeng, M. Li, J. Wang, Y. Hou, W. Lu and Z. Huang “Overview of Rubik’s Cube and Reflections on Its Application in Mechanism” Chinese Journal of
Mechanical Engineering ,Vol.31, Issue 1, (December 2018): pp.1-12.
[12] Ayman M. Abo El-Maaty, Magda B. Fayek “Observations on Exploration and Exploitation Effects on Solving Rubik’s Cube Using Evolutionary Strategies”
International Computer Engineering Conference, Cairo, Egypt: IEEE, 2017. pp. 9599.
[13] Hassan Samadi, Mohammad Reza Daliri “Solve the Rubik’s Cube with Robot Based on NonInvasive Brain Computer Interface” Iranian Conference on
Intelligent Systems (ICIS), Bam, Iran: IEEE, 2014. pp. 4-6.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 3479