Cubik: a visualization project for Rubik's Cube (click here for a video demo)
- Read Dependency and Compilation and build the application;
- Glance at instructions in Basic Operation, rotate faces in whatever way you like until solving it becomes interesting;
- In case you stuck at some point, invoke hint mode by pressing H; you may want to familiar yourself with Notations that appear in the hints;
- Follow the hints and solve the puzzle. Don't worry if you mess up with steps shown in the hints -- the hints will get updated in real time.
- press down and hold left button for roration
- press down and hold right button for translation
- forward/backward rotate middle wheel for zoom in/out
- press F to toggle on/off the face color indicator cube on bottom left corner
- press Ctrl+S to take a screenshot
- press Ctrl+Q to exit
- double click on a face to activate it, then rotate
- double click at any point not on the cube to deactivate face selection and back to view mode
- when a face is activated, Ctrl+(left|right|wheel) mouse buttons enables temporary view mode without exiting the interactive mode
- press H to toggle hint mode (next move and number of moves left shown on top left)
- Qt 5: Cubik is built upon the Qt framework. You need at least Qt 5.2.1 to compile it. If your default Ubuntu repository does not contain Qt5, check out this link.
- GLU: Starting from Qt 4.8, the GLU dependecy has been removed from standard Qt versions. Since the library we use still depends on GLU and GL, you may have to install these OpenGL pacakges if they are not already installed. Generally this can be done by (the second apt-get is necessary only if "-lGL is missing" after attempting to compile Cubik after executing the first apt-get; see source link)
sudo apt-get install mesa-common-dev
sudo apt-get install libglu1-mesa-dev -y
- libQGLViewer: Cubik replies heavily on the library libQGLViewer, which is a C++ library based on Qt that eases the creation of OpenGL 3D viewers. We have already included the header files and compiled libraries (under Ubuntu 14.04 LTS) to Cubik. As long as you have Qt and GLU installed, you should be fine.
This compilation procedure has been tested on multiple independent machines running Ubuntu 14.04 LTS (Trusty Tahr).
Follow these steps to copy this repository to your local directory and build:
git clone https://github.com/trgao10/Cubik
cd Cubik/
qmake
make
After the compilation, you need to specify the path to load shared libarary "libQGLViewer.so":
export LD_LIBRARY_PATH=./lib:$LD_LIBRARY_PATH
That's all. Happy Cubik-ing!
./Cubik
The solution integrated into this version of Cubik is based on Mark Jeay's algorithm. This algorithm is classic for beginner-level users since it is solved intuitively layer by layer. However, it is definetely not a fast algorithm which involves more steps than some other solutions.
The notation is adapted from an earlier Rubik's Cube Contest. The 6 faces of the cube are denoted as U (top/yellow), D (bottom/white), F (front/blue), B (back/green), L (left/orange), and R (right/red), respectively. Each solution step provided in the hint mode indicates one of the following two operations on the corresponding face:
-
90-degree turn clockwise: U, D, F, B, L, R;
-
90-degree turn counter-clockwise: U', D', F', B', L', R'.
Note that clockwise and counter-clockwise turns are viewed with respect to the center of the face.
The solution algorithm consists of 7 phases in general:
-
solve up layer edge pieces;
-
solve up layer corner pieces;
-
solve middle layer;
-
put down layer edge pieces in correct positions;
-
put down layer edge pieces in correct directions;
-
put down layer corner pieces in correct positions;
-
put down layer corner pieces in correct directions.
The hint mode specifies which phase of the algorithm the user is currently at.
This code is released under the terms of the GNU-GPL license Version 3. Any software you create that uses any part of this source code (or its compiled version) will have to be open sourced under the same conditions.
If you would like to use the libQGLViewer library in your applications, you should consult its license page.
Tingran Gao ([email protected])
Wenyuan Jiao ([email protected])
Jincheng Li ([email protected])
The contributors thank Shiwen Zhao ([email protected]) for compilation testing this project. The first contributor also thanks Gilles Debunne ([email protected]) for many useful discussions.
Duke University, Dec 2014