/rubik_cube

Implementing a Rubik's Cube in pygame.

Primary LanguagePythonMIT LicenseMIT

Rubik's Cube

Sample Image

Goals

  • Modelling Rubik's cube in python.
  • Rendering the cube in 3D.
  • Rotating the cube in 3D based on user input from keyboard and mouse.
  • Visualising the rotations and moves of the cube.
  • Animating transitions accompanying rotations.
  • Automate solving rubik's cube by computer using known algorithms.

User Input

L is for rotating LEFT face. R is for rotating RIGHT face. U is for rotating UP face. D is for rotating DOWN face. F is for rotating FRONT face. B is for rotating BACK face.

X is for rotating about RIGHT axis. Y is for rotating about UP axis. Z is for rotating about FRONT axis.

Modifier keys

SHIFT is for anti-clockwise rotation, by default clockwise rotation. CTRL is for moving two layers together.

Rotating the cube

mouse drag is for rotating the cube. ←, ↑, →, ↓, [, ] for rotating the cube using keys.

Saving Cube Positions

S is for saving current cube spatial orientation. I is for resetting the cube spatial orientation to previously saved orientation.

Functions

H is for randomly shuffling using 50 steps. J is for solving till the next step. K is for solving the entire cube. Pressing SHIFT along with the above keys visualizes the moves.

Quiting

ESC and Q for quiting the simulation.