Skip to content

Solving Rubik's cube and pocket cube with deep learning and physical maschines

License

Notifications You must be signed in to change notification settings

MarcOnTheMoon/cubes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pocket Cube and Rubik's Cube Solvers

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.

Overview

This is what we did so far:

  1. 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.
  2. 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.
  3. 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.)

Pocket cube device

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".

Rubik's cube device

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.

Deep learning

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.

Upload status (uploaded or still to come)

  • 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

Contributors

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)

Contact

Marc Hensel, University of Applied Sciences Hamburg (HAW Hamburg)

http://www.haw-hamburg.de/marc-hensel

About

Solving Rubik's cube and pocket cube with deep learning and physical maschines

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published