Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

From X3D Fritz to AlphaZero, what makes chess engines tick?

Today, chess engines are an essential part of the training regime of practically every professional player. That’s why many were taken aback to hear that D Gukesh, who won the Candidates tournament last week to become the youngest-ever contender of the World Chess Championship, was deliberately kept off chess engines till he crossed an Elo rating of 2,500, a level generally occupied by Grandmasters.

Fundamentally, chess engines are computer programmes that can play chess. The engines are able to think several steps ahead, learn from millions of previous games and evaluate the quality of key positions arising after a sequence of forced moves. With their theoretically unbounded memory power, it’s safe to say that computers can beat humans at chess. The best chess engines today are rated way above Magnus Carlsen, the highest-ranked player of all time.
However, beating engines is not the point anymore, pointed out Rahul Muthu, a computer scientist at Dhirubhai Ambani Institute of Information and Communication Technology, who sometimes plays competitive chess himself. “A computer is a fatigue- and boredom-proof automaton. Practising with it is like training yourself against granite so that when you finally hit a slab of wood, it’s probably going to be beneficial.”
A chess engine allows a player to analyse their game by suggesting a sequence of moves and providing them an evaluation number. An evaluation score of 0 indicates that neither black nor white has an advantage; the more negative the score, the bigger the advantage for black, and the more positive the score the bigger the advantage for white. “In this way, the engine can show you a path,” says Muthu.
Instead of starting at the beginning of a game, top players may choose to start deeper, say at move 20 or 25. “There are some standard configurations that players may choose to train for so that they are prepared if it happens in the actual game. Alternatively, the player may go into uncharted territory, or they may go into a territory that the opponent may have looked at but hasn’t played in many years,” he suggested.

From a computer’s point of view, chess is nothing but navigation through a finite graph, where each configuration of the chessboard constitutes a node. Neeldhara Misra, a computer scientist at IIT Gandhinagar, describes the game as a “tree”, or an enumeration of all possibilities that can happen over the course of the game. In a simpler game like Tic-Tac-Toe, this is easy enough to do. But for a game like chess, with 64 squares and 32 pieces, the number of possibilities is massive – 10^120 to be precise. For the magnitude of this number to sink in, it helps to compare it with 10^80, the estimated number of atoms in the universe.
“Anyone could write the code for a chess engine that uses brute force to generate all possibilities, but with such big numbers, this may not be feasible,” says Misra. “Some optimisation, in the form of “pruning” may be needed.” Pruning is a standard optimisation technique in algorithms where some branches are cut off from the game tree, thereby allowing for a considerably faster search. In the case of chess engines, this could include highly unlikely configurations.
Earlier generations of chess engines suffered from what was called the horizon effect. This is when computers are limited to only calculating for a number of moves or “plies” down the game tree, because of the immense number of possible positions. In 2003, former World Chess Champion Garry Kasparov famously exploited this very vulnerability of the X3D Fritz chess programme, thereby managing to draw one of his matches against the computer. Kasparov was no stranger to the era of human-versus-machine chess, having taken part in arguably the highest-profile match of this kind against IBM’s computer Deep Blue, back in 1996. He won that one, though, in the following year, the computer was victorious.
By 2017, the horizon effect was no longer a concern. Google announced its computer programme AlphaZero, which it claimed achieved a “superhuman” level of performance. “AlphaZero used machine learning to play millions of games against itself over 36 hours,” said Muthu. “It kept evaluating the frequency of success at every point, on every branch. Based on the success and failure of these games, it evaluated various moves. AlphaZero went beyond previous ideas, it entered the territory of probabilistic and stochastic models.”
Currently, there are dozens of different chess engines with varying features and methodologies. The best of them are a product of collaborations between computer scientists and Grandmasters. One of them, Stockfish, stands out as it is open-source, meaning its code is free to use and contribute to. As of today, it is the highest-rated chess engine in the Computer Chess Rating Lists (CCRL), with a rating of approximately 3642. Compare this to Carlsen’s all-time high of 2882.

For all its might, chess engines alone do not a Grandmaster make. There are still some ideas and concepts that humans are more suited to tackle. Moreover, over-reliance on them too early in one’s career can be detrimental. As Viswanathan Anand himself said in a 2019 interview, “It is always a good thing (to not depend on those) because the engines give you answers easily and you may not do the work.”
Muthu was surprised like many others to find out that Gukesh had not used chess engines for so long. “He honed his skills to such a high level without using anything external. I imagine that when someone like this finally does start using engines, the benefit they get will be massive.”
Nandita Jayaraj is the co-author of Lab Hopping: A Journey to Find India’s Women in Science, which explores the gender gap in Indian science.

en_USEnglish