Carnegie Mellon University

rubik's cube

January 30, 2017

Classroom creativity leads to Rubik's Cube how-to guide

Let’s face it: we all know at least one person who constantly amazes us with their hidden talents. Now you can be that person, too, thanks to Carnegie Mellon University alumnus Chris Barker.

All you need is a Rubik’s Cube and Barker’s Cubr, a computer application that provides you with a step-by-step guide to quickly solve the 3-D brain-teasing puzzle.

Barker graduated from CMU in May with a degree in electrical and computer engineering and a minor in computer science. As a first-year student in David Kosbie’s popular Fundamentals of Programming course, Barker created Cubr for his final project of the semester, a project that challenges students to design and build an original computer program.

“Its got to be a substantial piece of design and implementation,” said Kosbie, an associate teaching professor in the School of Computer Science.

Students have four weeks to develop and create original programs. Barker created Cubr because he enjoyed thinking about the different algorithms people applied when solving a Rubik’s Cube. Ultimately, he wanted to create an accessible program that would guide individuals through a complex problem.

“I wanted it to be kind of an instructional thing,” Barker said. “Educational technology is one of my interests.”

Cubr has three main components: the webcam interface, the rendering and the actual algorithm required to solve the Rubik’s Cube.

When using Cubr, individuals must first capture each face of a shuffled Rubik’s Cube with a webcam, holding the cube up to the camera and fitting each sticker into a pre-defined space.

After the user captures all six sides, a virtual cube appears on the screen that corresponds to the cube in their hands. Then, they can solve their own Rubik’s Cube by following the virtual one and the step-by-step instructions on the screen.

Barker began his project by working on the rendering of the application, or the display of the 3-D cube model.

“It was a personal challenge to write a program that could draw a 3-D cube onto a 2-D canvas,” he said.

As users work through the program, they will start to recognize the moves the algorithm uses to generate a solution, and as the patterns become familiar, they can begin to solve the Rubik’s Cube on their own.

“There’s two ways you could approach a Rubik’s cube solution algorithm if you’re programming it,” Barker said. “One is to just let the program search all the possible sets of moves that you could do until it finds one that leads to a solved cube.”

“The second method is to break it down into smaller steps. Like ‘Okay, first I want to get the entire top of the cube full of white stickers, and then I want to get the middle layer of the cube that has the stickers next to the middle square on each face to be the same color, and so on.’”

Barker used the second method to develop his program because he wanted his users to learn and understand the solution.

“If all you did was just say, ‘Okay I found the optimal algorithm for you. Now here’s what you need to do to solve the cube,’ then no one’s really going to learn how to solve a Rubik’s cube from that,” he said.

Kosbie said Cubr serves as a catalyst for students enrolling in the course.

“I can point to Chris Barker’s project as a pivotal project. He made it work so well. He has directly or indirectly inspired many hundreds of students at this point,” Kosbie said.

Barker now works for Facebook as a full-stack software developer working on Facebook Analytics for Apps. As an electrical and computer engineering graduate, Barker understands the importance and value of computer programming skills.

“I think it’s a skill that everyone should at least dip their feet into,” he said.