✉️

Rubiks Cube Simulation

Lessons Learned

  1. Quaternians are a headache...
  2. Slow down when debugging
  3. K.I.S.S.

---

Shortcuts

I've implemented a few shortcuts for convience. U, D, L, R, F, B will turn the UP, DOWN, LEFT, RIGHT, FRONT, BACK faces of the cube, respectively, in the clockwise direction if it were facing you. Holding SHIFT will make these turn in the counter-clockwise direction.

Alternatively, you can use X, Y, and Z to turn the faces on those axis. The default face will be UP for Y, RIGHT for X, and FRONT for Z. Holding ctrl will change the selection to DOWN for Y, LEFT for X, and BACK for Z. Holding SHIFT will again switch the direction from clockwise to counter-clockwise.

Some extra controls are Q for reseting the camera to view the front face, SHIFT+Q for reseting the cube to solved state, and S to randomly shuffle the cube.

Reflection

This was an extremely entertaining weekend project. I was recently introduced to the joy of Rubiks Cubes and I thought this would be a good way to begin learning about them. A huge help was learning about CDNs and the incredible convience they provide when using JavaScript as I don't have to download or host any libraries on my PC. This project also had me dip my toes in threejs to build a 3D space which got me to reaquaint myself with Quaternians.

I'm pretty happy with where this is at the moment, but I'd like to come back and create a solver eventually. I'm currently working off of the cube representation shown in this blog.

Related Projects