Tech

Watch a Computer Solve a Virtual Rubik’s Cube the Size of a Skyscraper

Representación virtual de un cubo Rubik gigante

The basic Rubik’s cube has 24 tiles and is shorter than a can of Coke. The world record for a human to solve the famous puzzle square is just under five seconds, and robots can do it in under one second. But not every Rubik’s cube is of such humble proportions, and larger cubes can take hours, not seconds, to solve.

Now, one YouTuber has built a computer program that simulates solving massive Rubik’s cubes. The largest that it’s solved is 32,768 tiles high, wide, and deep. That’s a total of 6,442,450,944 tiles, which would be roughly as tall as the 2,700 foot tall Burj Khalifa skyscraper in Dubai in reality. It took a computer more than 2,700 hours to complete, according to the YouTube video description, and watching the computer move the tiles in a time-lapse is hypnotic.

Videos by VICE

The program and video are the creation of YouTuber “ShellPuppy,” an American engineer and software developer. He started the project, he said in an email, after he watched a YouTube video showing a computer solving a 55×55 Rubik’s cube and thought that he could try something even more challenging. A 55×55 cube is “tiny,” he said.

“Computers have so much more memory and processing power,” ShellPuppy said. “So I sat down and did some back of the napkin math and figured out what I could do with 32gb of ram. I came up with 65,536×65,536 (I like powers of 2).”

He began testing but quickly realized that a cube of that size would take years for a machine to solve—he described his approach as using an “absurdly inefficient sorting algorithm”—so he settled on 32,768×32,768 because he would complete eight times faster. Hew knocked out the code to create the simulation over a weekend.

A problem, however, was that ShellPuppy didn’t know anything about solving a Rubik’s cube. “Full disclosure, I had no idea how to solve a Rubik’s cube,” he said. “To this day I’ve never actually sat down and solved a physical cube.”

To overcome this, ShellPuppy said that he watched YouTube tutorials about Rubik’s cube solutions and read research about solving strange-sized cubes. “I had to scrap my first few attempts since they were failing for the edge cases or were just too slow,” he said. Writing the solver code took him a few nights and weekends, he said.

Obviously, solving a virtual Rubik’s cube the size of a massive skyscraper presents some unique challenges. According to ShellPuppy, the corners of the mega-cube were no different than a typical 3x3x3 cube, and so they were easy to solve once the center was accounted for.

The jankiest part was solving the edges of the massive cube, ShellPuppy said. “Solving the edges wasn’t as elegant,” he said. “I made an algorithm that ‘worked’ but I’m sure is nowhere near the most efficient. However efficiency didn’t matter for the edges since they are insignificant in size compared to the centers.”

There’s definitely room for improvement, but ShellPuppy’s system does the job and he said that it’s scalable. The problem is that most computers can’t handle rendering and solving a bigger Rubik’s cube. “It’s like hitting a brick wall in terms of complexity. Even if you had a computer that was 10 times or 100 times faster you will just move that brick wall a little further.”

Importantly, ShelPuppy’s approach to solving a massive Rubik’s cube didn’t involve “artificial intelligence,” or AI—a clumsy term that’s commonly understood to mean deep learning programs. Researchers recently taught one such AI, called DeepCubeA, to solve a Rubik’s cube and take the most efficient route to completion.

Inelegant, inefficient, call it what you want—ShellPuppy’s approach worked and it’s something to see.