How Do Chess Engines Work?

Last updated

Chess is a manual game with both online and offline modes of opportunities to play. It is known for the utilization of the brain and the analytical nature of its players. One has to understand and analyze the game, each possible move, and its outcomes manually. 

But do you know, an online process to calculate the possible moves and its outcomes where you don’t need to devote your time analyzing is very much there! 

I know you must be thinking what is the point of utilizing computerized processes? And that too in a game like chess. 

Although a lot of players, mostly beginners, might prefer playing with computers without knowing how a computer engine works. Of course, if a player, who wishes to master the game of chess, and finds it difficult to opt for a trainer or a manual analyzer, a chess engine is for them.

Keep reading on to find out how the chess engine works!

The Chess Engine

The function of a chess engine is to code and analyze all the possible moves, followed by each move, by enlisting all the strong moves sequentially. It consists of a search function that can collect and show you all the possible moves at a position and evaluate the strength of each party. 

The combined result of function and interpretation by the computerized program helps to determine which is the best move to be play in that particular position.  

The engine functions in a neutralized manner, as it shows results for both white and black men.

The Chess Tree

So, while looking at the first glance towards the board, each side has 20 possible openings (we are not talking about the best move, but a possible move). 

Twenty moves because sixteen moves from pawn (one box or two boxes) and four moves from the knight. 

Remember that twenty moves are for the first move only for each side. 

When you calculate numerically, you have 400 possible moves after the first move itself (20 x 20). Sounding gross already? Let us continue elaborating. 

Before going forward let’s know about what ply means in the chess engine. Ply denotes half move, or in simple language turn. When white moves and the black is yet to be moved, then it is called ply. So, there is 2 ply in each complete move, and 50 ply in 25 moves.

Here’s a video from ProtonsTalk YouTube Channel about Computer Chess: How It Thinks! I highly recommend you watch this video to get more clarity about the topic.

The Algorithm Of Chess Engine

Algorithms are known to you all. But to be specific, an algorithm is a bunch of steps that use formulae of repeated codes or actions to evaluate and demonstrate a result of a specific action. This is a computerized method. 

Similarly, the chess engine also works on its own complicated algorithm. For example, the engine will note the move you played, then go back to the algorithm and come back to you with a whole lot of moves possible after processing through the algorithm. 

Some factors affecting the chess algorithm include:

  • More pieces
  • Movement
  • Pawn structure

While calculating, the engine itself cuts off the moves that are less impactful, just like you will do manually. But the engine will take seconds while a manual player may take 1 while a minute to choose the best move, and even more.

Now if you ever thought about how many chess games are possible, then I recommend you to check out this article here, where I explain more about it.

Moving Down The Chess Tree

Before reading the portion, you must know a few terms : 

  • Leaf node: the final position of one particular variation in a match is called a leaf node.
  • Branch: the sub position or other possible position rather than the best one is called a branch.
  • Ply: the partially complete move, that is either of the players has moved. 

Okay, so when and how does the algorithm start moving backward the tree and other branches? The simple answer to this is, that the chess engine first evaluates the positions, and movements, then within seconds the engine starts moving the movable piece backwards to the earlier position to understand which position will give them an extra advantage. 

In human language, we say the engine moves backward from almost the endgame by analyzing each piece To reach and evaluate the leaf node with the help of branches. And within seconds, the chess engine analyses the whole game and plays accordingly. 

For example, if your bishop is at g5 and moving your bishop will be the best move. Where to move? To find this chess engine goes down the branches. It will work by inter-calculating whether f4 or e3 or d2 or c1 or h4 to move to by back-calculation.

Here’s a video from Machine Learning Conference YouTube Channel about how to do chess engines work. You can also watch it to get some ideas.

Now let’s move on and discuss about some of the chess engines.

Some Chess Engines

Stockfish: the strongest chess engine at present. This chess engine is made available for the entire window, Linus, Android, and iOS users. It includes neural networks in its code for making better evaluations of chess positions.

Leela chess zero: it is inspired by DeepMind’s AlphaZero Project. Today it is the second strongest publicly available engine.

AlphaZero: it was developed by a robotics research company, deepMind. alphaZero was then undertaken by Google itself. AlphaZero is known for beating StockFish.

Fritz: it is a chess engine, developed by Frans Morsch and was added to ChessBase in 1991. If you want a chess engine for your windows and other platforms, you can go for Fritz as it has won a lot of computerized chess championships titles over the years.

Rybka: a chess engine that was prepared by IM Vasik Rajilich in the early 2000s, along with a partnership with ChessBase. Although ICGA (international computer games association) accused Rybka of plagiarism, later that was omitted by the confirmation of the FIDE Ethics Commission, which said that those claims were false.


As of now, you know all the details about the chess engine and how it works, and what a chess tree is. Also, you now know which chess engine you can go to if you want to obviously! 

The deeper the chess engine looks through the chess tree, the better the gameplay will be. 

Now you know the reason behind easy wins from the computer in our early days because back then it was not capable of looking deep and making the best move possible, but today if you win a tough game with a program, you have a really sharp mind and are tactical enough! Good job!

Are you thinking of becoming a chess grandmaster? Then I highly recommend you to check out this article on how to become a chess grandmaster.