Hands playing a Rubik's Cube game

The Rubik’s cube (above) befuddles many humans — but not a neural network dubbed DeepCubeA. Credit: tzahiV/Getty


AI solves the Rubik’s cube

An algorithm unerringly finds solutions for a mind-bending puzzle.

For the first time, a deep-learning algorithm has taught itself an efficient way to solve a Rubik’s cube.

A Rubik’s cube has over 43 quintillion possible combinations — but only 1 solution, which is achieved by manipulating the cube until all 9 squares on each of the cube’s faces are the same colour. It’s a challenge for an algorithm to teach itself to solve such a puzzle if it is not given any strategic hints on how to do so.

Pierre Baldi and his colleagues at the University of California in Irvine developed a deep neural network — a type of artificial-intelligence algorithm — that figures out how to solve a Rubik’s cube. Their program works backwards from a solution to a given configuration to observe how closely the two are related. It repeats that process for a large number of configurations and combines those observations to determine optimal moves for solving the puzzle.

The algorithm solved the cube on every trial and, in more than 60% of trials, solved the cube with the smallest possible number of moves. The program could be applied to other puzzles with a vast number of potential combinations and a very small number of solutions.