Skip to content
Rubik's cube simulator and solver, IPython/Jupyter
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
cube.ipynb
requirements.txt

README.md

rubik

Binder

Rubik's cube simulator and solver in Jupyter notebook

  1. View the interactive Binder notebook.
  2. The notebook should render on Github: cube.ipynb.
  3. Use nbviewer.

Of course, forks and comments are welcome!

Setting up

Reset

position = reset_cube() will reset the cube to a completed position

Viewing

view_cube() will visualize the six sides of the cube

Rotating

RotateDown(n) will rotate the cube down, n times. The full list of rotations is below.

RotateDown(n) #rotates cube down
RotateRight(n) #rotates cube right
RotateCC(n) #rotates cube counter-clockwise

Playing with the cube

Moves

LU_Move.run(n) will execute the "Left-Up" move, n times. The list of moves is below.

LU_Move.run(n) #Left-Up
MU_Move.run(n) #Middle-Up
RU_Move.run(n) #Right-Up
TL_Move.run(n) #Top-Left
ML_Move.run(n) #Middle-Left
BL_Move.run(n) #Bottom-Left
RLU_Move.run(n) #Right Face, Left-Up (sometimes called Front-Left)
RMU_Move.run(n) #Right Face, Middle-Up 
RRU_Move.run(n) #Right Face, Right-Up (sometimes called Back-Left)

Mixing

mixup(n) will make n random moves on the cube, "mixing it up"

Solving

solve() will (should!) solve the cube, and print the raw number of moves. This is effectively the algorithm I use when I solve Rubik's cubes.

Have fun!

I sure enjoyed this project. Let me know if there are bugs or comments :-)

You can’t perform that action at this time.