How to Write a Rubik's Cube Solver

By Sam Saariste

In this talk I share a journey of developing a Rubik’s cube solving library that can be used for a wide range of applications in this space. The original purpose was to teach Python to my 12 year old son who happens to be able to solve a Rubik’s cube in 10 seconds. Soon, this teaching project turned into a shared quest to design a Rubik’s cube solving framework that can be used as a teaching tool to do sample solves at all possible skills levels, but also as a tool to find optimal solutions for specific cases that speed solvers may come across. We even modelled how efficient a human could execute a sequence of turns depending on whether regrips will be necessary, which is important for speedsolvers who execute up to 15 turns per second. We tried different data structures for cube representations and settled on an efficient one with some very interesting properties allowing for elegant solutions. I will show how a "dumb" solver for specific problems, such as solving the first for edge pieces, can find optimum solutions quickly without requiring any heuristics or prior cubing knowledge. Define a cost function in combination with some dynamic programming provides a solution that has proven very successful for us. You are not expected to know how to solve a Rubik’s cube, but you may get interested as a result. If you do how to solve a cube, you may find it even more interesting.





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.