Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.
/ Rubik-Cube Public archive

Rubiks cube solver written on c++ with OpenGL and GLUT

Notifications You must be signed in to change notification settings

lipa44/Rubik-Cube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Rubik's Cube via visualization using OpenGL and GLUT

Language: C++

OS: macOS

  • Requires frameworks OpenGL and GLUT (recommend to use XCode or AppCode with included frameworks)
  • Average amount of rotates for cube solving is 150-200

Some info about code:

  1. To edit rotation speed you need to change ROTATE_SPEED_STEP in Cube/CubeSettings.h from 15 by a number, which is correct for (ROTATE_SPEED_STEP*x + ROTATE_START_VALUE) % 90 == 0, where x - is a natural number
  2. You need to write the unfolding of the cube in input.txt in the strict order of planes: Up -> Left -> Front -> Right -> Back -> Bottom
  3. If you want to put words "orange", "white" etc. instead of "O", "W" etc. in input, you need to change maxWordSize in Other/HelpingFunctions.h from 1 to 6 and uncomment respectively code string in PrintRubikCube() (it's marked)

unfolding

Large unfolding

  1. Function CheckIfCubeCorrect() evaluating the correctly of centers and if they are wrong, it throws an exception once you'll click Find Solution
  2. You can rotate planes in a window using keys 1, 2, 3, 4, 5, 6 for Up, Left, Front, Right, Back, Bottom plane respectively
  3. Using keys up_arrow, left_arrow, down_arrow, right_arrow rotates cube by X and Y coordinates
  4. "Solve cube using only right (left) and up rotates" works only with a solved cube
  5. cout <<" \ b "; in code cleans up 1 symbol from the console - if you'll try to refactor smth, you need to know it
  6. If you want code to show you solving time, you need to uncomment // Timer SolvingTime;, but be careful: it could crash all code if nothing used before "Cube-solver-MachineGun"

An example of output for solving 10 millions cubes

  1. You can read one cube's unfolding from input once, at the second time it'll read the next symbols from the file (nothing)
  2. If the cube's unfolding is incorrect and you'll try to find a solution, the cube will start to rotate it planes, but after a huge amount of useless tryings of solving it'll write that cube is incorrect (no other way to prove that cube can't be solved)

About

Rubiks cube solver written on c++ with OpenGL and GLUT

Topics

Resources

Stars

Watchers

Forks