Dealing with artificial intelligence (AI), we were curious how to let computers learn to solve a scrambled Pocket cube (2x2x2) or Rubik's cube (3x3x3). Okay, this is challenging enough. Still, wouldn't it be even more fun to demonstrate the results by machines that mechanically solve physical cubes? Join us on this fascinating endeavor.
This is what we did so far:
- Rubik's cube device: A team of five students has built a high-performance device for Rubik's cube based on lots of fancy hardware and a provided algorithm. The movements to solve a scrambled cube take well below 1 s.
- Deep learning: In scope of his Master thesis, Finn Lanz has implemented, analyzed, and modified approaches based on reinforcement learning to let computers learn how to solve cubes. Due to required resources, the experiments focused on Pocket cubes.
- Pocket cube device: I have developed a low-cost device to mechanically solve scrambled Pocket cubes. (Finn and I wanted to have a cool hardware demonstrator for his Master thesis.)
The Pocket cube solver shown in the images below is, on purpose, based on low-cost hardware, consisting mainly of an Arduino board, two servo motors, a PWM module, and 3D-printed parts. In case you want to rebuild the device, please note the detailed documentation in the folder "docs" describing assembly, calibration, and the software. All source files (Arduino, Python) are located in "src/pocket_cube_device", and the 3D print files on Thingiverse. Additionally, there is a short video file in "assets/videos".
The Rubik's cube solver shown in the image below consists of a control cabinet with motor drivers, microcontroller, and such (left) and the hardware containing the cube, motors, cameras, and such (right). The device is operated by a Laptop connected to the control cabinet. The project report (German) providing technical information is in "docs". Additionally, there is a short video file in "assets/videos" which shows a cube being scrambled twice (slowly) and solved (much faster). We intend to provide more information and source codes after a review - please be patient.
In scope of his Master thesis, Finn has trained several models to solve scrambled Pocket cubes. Furthermore, he has developed a program to scan the colors of Pocket cubes placed in the Pocket cube device and physically unscramble them. The Master thesis is available in the folder "docs" (in German language). An extended OpenAI gym environment with 2D and 3D rendering and a simple sample agent and policy to demonstrate its use are in "src". The application software and training of more sophisticated models will follow - please be patient.
- Master thesis on reinforcement learning and Pocket cube solver
- Pocket cube device (documentation, 3D print files, source codes)
- Rubik's cube solver (documentation)
- Reinforcement learning (gym environment, sample)
- Reinforcement learning (source codes to train models, trained models)
- Pocket cube application (including trained models)
- Rubik's cube solver (source codes)
- Refactoring of Rubik's cube device
- Better sample videos
My deepest thanks go to following magnificent students of our Department at HAW Hamburg, who raised my interest for this topic and contributed by their brilliant work done with remarkable passion:
- Sophie Kirchhoff (Rubik's cube device)
- Finn Lanz (reinforcement learning, integration of Pocket cube hardware)
- Kim Henrik Otte (Rubik's cube device)
- Marvin Paetow (Rubik's cube device)
- Christoph Rathjen (Rubik's cube device)
- Kim Kristin Westphal (Rubik's cube device)
Marc Hensel, University of Applied Sciences Hamburg (HAW Hamburg)