3D Rubik's cube implementation using C/C++ with Vulkan. This project was made with the following software version:
- Linux Ubuntu 22.04
- Vulkan Instance Version:
1.3.204
- C/C++ compiler Version:
11.4.0
- Python version:
3.10.12
- Is it possible to watch the cube with different angles just use
WASD
to move and arrow keys to move the view. UseQ
to go down andE
to go up. - The possible moves are
UDFRBL
, the keys associated with these turns are respectively from1
to6
. To enable/disable double turns press9
and to enable/disable anticlockwise turns just press0
. - The projects uses the
Kociemba algorithm
, to solve the cube just pressspace
. The first time solving the cube will be slow because the solver has to generate the prunetables for calculating the solution, after that the time for calculating the solution should be around 2-3 seconds. When calculating the solution the cube turns are disabled
If everything works this should be the output:
cubeSample.mp4
The following instructions are for Ubuntu
, for other operating systems read here.
Ubuntu comes with python preinstalled but to make sure that everything is installed just run this commands:
g++ --version
python3 --version
To install Vulkan
and development tools just execute in the terminal:
sudo apt-get install vulkan-tools
sudo apt-get install libvulkan-dev
sudo apt-get install vulkan-validationlayers-dev
sudo apt-get install spirv-tools
sudo apt-get install libglfw3-dev
sudo apt-get install libglm-dev
sudo apt-get install libxi-dev
sudo apt-get install libxxf86vm-dev
The shader compiler used is glslc
, to download it click here by selecting the gcc
release. This will download a .tgz
file, just extract it and copy the glslc
executable in usr/local/bin
:
# go where the file is downloaded
cd path/to/install.tgz
# extract the file
tar -xzvf install.tgz
# copy to `usr/local/bin`
sudo cp -r install/bin/glslc /usr/local/bin
The cube is solved using Kociemba
algorithm, for ubuntu you might need to install libffi system library, for more information check here.
Also the solver is written with python so python-dev
is necessary to make c/c++ and python communicate:
# libffi system library
sudo apt-get install libffi-dev
# python dev
sudo apt-get install python3-dev
To compile and execute just run run.sh
:
bash run.sh