DEV Community

Fabian Frank Werner
Fabian Frank Werner

Posted on

Why Computers Fail At Chess

Why do computers fail at chess? See, chess is a strategy board game based on mathematics. So logically, computers should one day play better chess than any human grandmaster ever will, right? Wrong, computers fail at chess, and here is why!

The perfect way for a computer to play a game of chess is the so-called brute force method; in which the computer calculates every possible course of the game. Which moves are possible for the computer? Which moves are possible for the opponent? And so on… This approach results in a complete game tree. A game tree shows every conceivable course of a game, whether it ends in victory or defeat. This knowledge allows the computer to play flawless chess. The computer would recognize every path that would force a certain victory regardless of the opponent's actions. You could never set a trap and the computer would immediately exploit every mistake you make. With foresight over hundreds of moves that a human could never keep up with, the computer delivers a perfect game of chess, every time…

But how many possible courses can a game of chess have, that the computer needs to calculate? Let’s refer to a player's action as a move. The first player (white) can open the game with 20 possible moves. The second player (black), then also has 20 possibilities as a first move. This means that after both players have made their first move, there are 20 times 20, so 400 possible games. If white then moves again, there are already 8,902 possible game variations. Only after ten moves, meaning after each player has moved a piece five times, there are 69 trillion possible games that could theoretically be played. With each additional move, this number grows so much that the final number of possible games cannot be calculated.

Mathematician Claude Shannon gave a rough estimate known as the Shannon number. He estimated that players can make an average of 30 possible moves per turn and that a game consists of an average of 80 moves. This gives about ten to the power of 120 chess games that are possible. This is still a lower-bound estimate, which means that the true number is much higher. The fundamental problem lies in the enormous size of this number. It is difficult to imagine the real size of a number with 120 zeros. A modern supercomputer would need 10 to the power of 90 years to calculate the game tree of a complete game of chess. This means that the time of our universe, since the Big Bang would not be enough for the computer to make the first move. Even a billion times this time would not be enough. Besides, in 1997 the computer Deep Blue became the first computer to beat a reigning world champion in a chess competition. Computers can also find other ways to make game-winning decisions. They do this, for example, by selecting meaningful small areas of the game tree, or by targeting certain game positions, or analyzing all the opponent's past games. The last example was used in deep blue, where chess grandmasters incorporated their thinking into the programming and the code could be adapted between games. whether this was still a victory of pure computer power is a matter of opinion.

But this also means that Deep Blue did not play perfect chess. The fact is, computers are getting better than humans. But they can only play as well as they're programmed. And would always be beaten by a computer using the brute force method. Still, we are used to an immense increase in computing power. So, is it possible that a computer with incredible computing power will one day play chess perfectly? To perform such a calculation, the results of the individual games have to be stored temporarily. and in order to store information, a storage medium such as a piece of paper, a brain cell, or tiny components in computer chips is needed. So the storage medium needs a piece of matter that consists of particles. Now there are about ten to the power of 80 atoms in our observable universe, which is significantly less than the ten to the power of 120 possible game sequences in chess. So for every existing atom, there are billions of possible chess games. Our entire observable universe simply does not offer enough storage space for a perfect chess computer. How far technology may develop, we will probably never know what the flawless moves of a perfect superior chess intelligence look like.

Top comments (0)