Computer Chess Engines: A Quick Guide
Chess has been fascinating players and spectators for nearly 2,000 years. With the technological revolution of the last 100 years, computers have become an increasingly important part of our lives, and their effect on chess has been substantial.
Hardware and software developments have given programmers a powerful environment where they can merge chess and computers together.
This article is a brief guide to understanding how chess computers (chess engines) have affected the game of chess:
- Definition
- When they were invented
- Human play
- Traditional chess engines
- Neural network
- Watching engine games
- Top chess engines
What is a chess engine?
A chess engine is simply a software program that plays and analyzes chess. The word “engine” simply refers to a kind of high-powered program that does a lot of searching and processing—similar to a search engine.
When were chess engines invented?
Humans have always been fascinated with machines—including chess-playing machines.
In 1796, a fake chess-playing machine called the “Automaton” was created, but it had a strong human chess player hiding inside playing the moves. In 1912, a machine was created that could actually checkmate with a king and rook vs king.
But it wasn’t until 1951 that a computer program was written by Alan Turing that could actually play chess. For the next 50 years, programmers worked on making their chess engines better, and improvements in hardware allowed for stronger play. By 2005, chess engines had definitely become stronger than the best human players. In the years since, they have improved significantly, and now there are hundreds of computer programs that are stronger than human grandmasters.
How have chess engines affected human play?
Humans have gotten better at chess over time as they learn from the collective wisdom of past players. Computers have accelerated this progress, as chess engines have added new knowledge and understanding to the game.
The top players today use chess engines extensively to analyze positions and generate ideas. Unfortunately, this has also introduced cheating to chess, where any player using merely a mobile phone and a chess engine can play better than any grandmaster.
Online chess servers like Chess.com catch hundreds of cheaters each day who cannot resist the urge to win games using computer assistance. Still, fans of the game have benefitted from engines as they have helped improving players get better through analysis, and have also created a spectator sport where top chess engines battle to see which is best.
How does a traditional chess engine work?
Chess engines are complex. However, in simplest terms, they do two important things:
1. Evaluate. Chess engines look at individual positions and evaluate which position is better. Almost all chess engines display a evaluation number, or “eval,” based on the same scoring that most chess players use (a pawn being worth one point, a minor piece three, etc). Each chess engine does this differently, but most engines look at things like material on each side, all the threats on the board, the king safety, and pawn structure.
The cumulative score of the best evaluation in the future is summed up to one number. Traditional engines evaluate similarly to humans because they were designed by humans. Neural net engines (see below) evaluate differently.
The position below is given a cumulative score of +3 by the computer engine Stockfish even though material is equal, because White's piece development is much better. This means that the white position is roughly three pawns better.
2. Search. Like good chess players, engines try to look deeply into the position. The further ahead they can see, the better the move they can make now, as they can evaluate positions that will result after the best possible moves in the future. Each individual chess move is called a “ply” (a layer), and the depth is explained in how many ply deep. At 20 ply (10 white moves, and 10 black moves), most engines are already evaluating far deeper and stronger than humans. Depending on the time allowed and the complexity of the position, engines can look more than 50 ply deep.
From the current position, an engine starts to look at all of the possible moves and replies. And then all of the possible replies to that. And then all of the possible replies to that! Imagine there are 32 possible moves in any position. After four moves, there are already more than one million positions to evaluate. After just four more moves, that would be more than one trillion position. That becomes extremely unpractical.
So instead, engines try to use smart “pruning” to look deeply at just the most promising lines, and ignore the obviously bad ones. The engine keeps a running “principal variation” (PV) of the most promising moves in every position.
Traditional chess engines use complex evaluation functions and intelligent search algorithms to find the best possible move. Their power is also related to how much CPU processing power the phone, computer, or server has. The more powerful and plentiful the CPUs, the stronger the engine becomes.
What is a neural network engine, and how is it different?
A neural network (NN) engine is a different kind of chess engine. The first NN was AlphaZero, created by DeepMind (a Google company). In 2017, AlphaZero reportedly crushed Stockfish, the best traditional engine, in a 100-game match. But the match was private and many have questioned the results. However, in 2019, the open-source Lc0 (Leela Chess Zero), did finally become the world’s strongest chess engine in the Chess.com Computer Chess Championship.
A neural network is a series of algorithms and instructions used to evaluate a chess position—except we don’t know exactly how! A NN is “trained” by feeding it data (in this case, chess games), and then letting it learn on its own. This is traditionally called machine learning.
The games can come from external sources (like grandmaster games). Or, as in Lc0, the game data comes from playing more than 200 million games against itself. So for NN engines, their evaluation is provided by the neural net.
The introduction of NN engines has also change how search is done. Traditional engines have typically used what is called an alpha-beta (AB) minimax search, where only the best possible moves are evaluated. NN engines, however, choose to use what is called Monte Carlo tree search (MCTS), where the best move is selected based on the probable outcomes of many playouts. Basically, it plays a ton of quick games against itself at super fast speeds with random moves and looks at the moves that seem to have the highest odds of winning.
NN engines also get stronger based on the type of hardware they are run on. They need powerful CPUs. But, even more so, they need powerful GPUs (graphics processing units, like in many gaming computers), because GPUs are faster at processing neural nets.
Where can I watch chess engines playing?
There are several online chess engine tournaments that match up the best engines. Chess.com runs the Computer Chess Championship, which is an ongoing series of engine-vs-engine tournaments with different engines and formats that you can watch 24/7!
What are the top chess engines?
There are many ways to determine the top chess engines. A lot depends on hardware, time control and methodology used. You can look at the rankings for past chess events (such as the CCC), or different online rating systems. The most recent CCC was won by Lc0, with Stockfish second, Leelenstein third and Antifish fourth.
How does each of the top engines work, and how is it different from others?
Traditional Chess Engines:
Neural Network Engines:
Traditional Chess Engines
Stockfish:
Stockfish is an open-source chess engine developed by a large community of chess engine enthusiasts and developers. It has been the strongest traditional chess engine since 2016. Many of the modern chess engine programming methods were pioneered through Stockfish. It uses a complex eval formula and A/B search.
Komodo:
Komodo is a private commercial engine originally developed by Don Dailey and now continued by Mark Lefler and grandmaster Larry Kaufman. How it works is not publicly known, but it claims to rely on a more sophisticated evaluation based on grandmaster understanding and the insights of GM Larry Kaufmann, which is supposed to give it a more human style. It uses a traditional A/B search. It is currently the second strongest traditional chess engine.
Komodo MC:
Komodo MC is the Monte Carlo search version of Komodo. While the evaluation is the same as regular Komodo, the way it searches is with Monte Carlo tree search instead of A/B minimax. While not quite as strong as regular Komodo, it is improving more quickly.
Houdini:
Houdini is a private commercial chess engine published by Robert Houdart. It has a very fast search and performs well in faster time controls. It loses very few games, and can escape from difficult positions (like its namesake). It is currently the third-strongest traditional chess engine.
Fire:
Fire is a private non-commercial chess engine by Norman Schmidt. It was originally released in 2010.
Ethereal:
Ethereal is a relatively new open-source chess engine by Andrew Grant, developed mostly as a way to learn and improve his programming. It was created in 2016, and was inspired by Stockfish and other chess engines.
Shredder:
Shredder (or Deep Shredder) won many tournaments and titles in the 1990s and went commercial in 1996. Stefan Meyer-Kahlen is the author.
Laser:
Laser is an open-source chess engine created in 2015 by the brothers Jeffrey and Michael An, technology students in California.
Neural Network Engines
Lc0:
Lc0 (Leela Chess Zero) is an open-source, community-driven neural network engine. Lc0 has a net based on reinforcement learning, which means it has played itself more than 200 million games, and learns only from playing itself. When it first starts its training, Lc0 knows nothing more than the rules of chess.
It uses a Monte Carlo tree search to choose its moves. Lc0 is currently the strongest chess engine in the world, winning the Chess.com Computer Chess Championship in 2019. Lc0 plays a very different kind of chess from Stockfish. It creates exciting, attacking play, and makes moves that traditional chess engines do not understand. Lc0 tends to play endgames in a strange way, often giving up material on purpose to simplify the game instead of choosing the quickest win.
Leelenstein:
Leelenstien uses most of the code of Lc0, but has a different neural net based on supervised learning, being fed millions of previously-played chess games from chess engines, as opposed to learning from its own games. This net has proved to not be quite as strong as Lc0’s net.
Antifish:
Antifish also uses most of Lc0’s code, but has a neural net based solely on games played between Lc0 and Stockfish, in an effort to beat Stockfish. Antifish is not as strong as Lc0 or Leelenstein.
Allie:
Allie is a unique NN engine written by Adam Treat. Allie uses its own Monte Carlo search, move selection, and time management code. Allie can be used with any net, and does not have a net of its own. The Allie author is looking to add A/B search to his engine.
Do you have any questions about computer chess engines? Let us know in the comments.
If you want to watch some of the world's top computer engines play right now, tune in to the Chess.com Computer Chess Championship here.