Play for Science

Computer scientists are developing programs to win popular games. In the process, they are developing solutions for other, more serious, puzzles.

Daniel Kunkle spent most of his time in graduate school playing with a colorful puzzle called a Rubik’s Cube. And for 20 years, Jonathan Schaeffer worked on winning at checkers.

The two researchers weren’t goofing off. With clever computer programming, Kunkle figured out that any Rubik’s Cube can be solved in 26 moves or fewer. The previous record was 27. And Schaeffer proved that if both opponents in a checkers game play flawlessly, the game will always end in a tie.

 

Playing games and puzzles is a great way to sharpen your problem-solving skills.

 

iStockphoto.com

Studying puzzles and games may sound like fun, but the work might also eventually help scientists solve real-world problems.

Cracking the cube

Each side of a Rubik’s Cube is divided into nine squares, like a tic-tac-toe board. When the puzzle is solved, all nine squares (called facelets) on each side are the same color as one another. So, there’s a red side, a green side, and so on. Hinges allow rows of facelets to rotate.

 

When the puzzle is solved, each side of a Rubik’s Cube contains squares, or facelets, of just one color.

 

TheCoffee/Wikipedia

A series of random rotations mixes up the colors. To solve the puzzle, you have to make the right series of twists to group the colors.

The facelets of a Rubik’s Cube can be arranged in about 43 quintillion (that’s 43 with 18 zeros after it) possible ways. By hand, it can take a long time to find a solution.

A computer can try every possible move and compare solutions to solve the problem much more quickly. But with so many potential arrangements (also called configurations), even the world’s fastest computer would need a ridiculously long time to solve the problem.

To save time, Kunkle and computer scientist Gene Cooperman of Northeastern University in Boston, Mass., looked for strategies to break the problem into smaller pieces.

First, they calculated how many steps would be required to solve the puzzle using only half-turns, which send a facelet to the opposite side of the cube. They excluded quarter-turns, in which a facelet ends up on the side of the cube right next to where it began.

Their study showed that only 600,000 possible configurations can be solved this way. Using a desktop computer, Kunkle discovered that all these arrangements could be solved in 13 moves or less.

Puzzle pieces

Next, the researchers wanted to calculate how many steps would be necessary to turn any other configuration into one of the special 600,000 presolved arrangements. That required a time-consuming search through 1.4 trillion configurations. To speed the process, Kunkle and Cooperman wrote a program for an extremely fast computer, called a supercomputer.

 

A mixed-up Rubik’s Cube can take many hours to solve, unless you have the brain of a supercomputer!

 

Matthew Fisher

It took the supercomputer 63 hours to do the calculations. Results showed that any configuration could be turned into one of the presolved, half-turn configurations in 16 moves or fewer. Remember that it took a maximum of 13 steps to solve one of these special configurations. In sum, the researchers concluded, any configuration could be solved in a maximum of 29 steps.

That result fell shy of the record 27 steps established a year ago by another researcher. Kunkle and Cooperman noticed, however, that only about 80 million configurations (far less than 1 percent of all possibilities) actually needed more than 26 steps to reach a solution. So, the pair focused on those few, hardest arrangements.

This time, instead of searching for ways to turn each tricky configuration into a special configuration, they searched through every possible way of solving each one.

The effort paid off: They set a new record of 26 steps. Researchers think the absolute minimum is just 20 moves, but they have yet to find a way to prove it.

The strategies that Kunkle and Cooperman used to solve the cube can be applied to other complicated problems, especially ones that require searching through lots of possibilities. Scheduling airplane flights to carry millions of people to a variety of destinations as quickly as possible is one example.

Checkerboard solutions

Solving the Rubik’s Cube was a major feat, but Jonathan Schaeffer of the University of Alberta in Edmonton, Canada, faced an even bigger challenge: winning at checkers.

On a traditional 8-square by 8-square checkerboard, each player starts with 12 pieces in his or her own back three rows. All moves are diagonal. During each turn, you slide one of your pieces a distance of one square toward your opponent’s side.

You can capture an enemy piece by jumping over it with one of yours into an open square. When one of your pieces reaches your opponent’s side, it earns the ability to move backward too. If you can remove all enemy pieces, you win.

 

At the beginning of a game of checkers, each player lines up his or her pieces on one side of the board. Players take turns moving a single piece one diagonal space at a time. (This is a special board with 100 squares and 4 rows of pieces per team instead of the usual 64 squares and 3 rows.)

 

Michel32Nl/Wikipdia

No one had ever attempted to write a program to simulate all moves on a checkerboard. That might be because the pieces on a checkerboard can be arranged in more than 500 quintillion ways (that’s a 5 with 20 zeroes after it). Compared to a Rubik’s Cube, a checkerboard has 10 times as many possible configurations.

Like the Rubik’s researchers, Schaeffer and colleagues started with a smaller problem. They imagined two pieces left on the board at the end of a game. For every position that those two pieces could occupy, a computer program simulated every possible outcome.

 

A game of checkers gets more complicated with each move.

 

PartsnPieces/Wikipedia

The program went through the same process for 3 pieces, then 4, and so on, up to 10 pieces. At that point, there were 39 trillion possibilities for where the pieces might be.

Checkmate

Whenever Schaeffer added a piece to the board, the time needed for calculations was 10 times as long as the time needed for the previous step. The computer was not powerful enough to continue the process.

So Schaeffer started over from the beginning of a game. His program considered all possible moves and countermoves until only 10 pieces remained the board. Since he had already figured out every way the game could end once there were 10 or fewer pieces left, he was able to combine the two programs to simulate an entire game.

In spite of Schaeffer’s efforts to cut down time, the computers took 18 years to finish the problem. “I’m quite amazed that I had enough patience to stick with this,” Schaeffer says.

 

It took computers 18 years to come up with a solution for the game of checkers. Chess, shown here, is an even more complicated game.

 

iStockphoto.com

Like the methods Kunkle developed for the Rubik’s Cube, Schaeffer’s strategies can be applied to practical problems in scheduling and even in human biology. The work might also some day help a computer play a perfect game of chess, which is far more complicated than checkers.

Take it from Kunkle and Schaeffer: Playing games can lead to serious science.


Going Deeper:

Additional Information

Questions about the Article

Word Find: Play This