How Do Chess Engines Work?

Chess Advice
September 7, 2023
Updated: March 19, 2024
man playing against chess engines

This article might possibly contain affiliate links. If you decide to click on any of these links and make a purchase, we may receive a commission at no additional cost to you. Thanks for your support.

Ever wondered how chess engines like Stockfish are able to beat even the best chess players in the world? You’re not alone.

Chess engines seem almost superhuman in their ability to calculate millions of moves ahead and choose the best possible path to victory.

But under the hood, chess engines are powered by algorithms and computing power, not actual intelligence. They rely on a technique called tree search to explore the game tree of possible moves and countermoves, evaluating the board at each step to determine the path most likely to lead to a win.

Let’s see this in more detail.

How Chess Engines Evaluate Positions

When chess engines evaluate positions on the board, they go through a complex process to determine the best move.

First, the engine analyzes all the possible moves for both sides. For each move, it plays through potential sequences of future moves to see how the position may develop.

It evaluates positions based on factors like material (which side has more valuable pieces left), space (which side controls more of the board), mobility (how much freedom each side’s pieces have to maneuver), and safety (how vulnerable each side’s pieces are to attack).

The engine then assigns a numerical value to each position to represent how good or bad it is for either side.

Positions where White has a clear advantage may be +1 or higher, positions that slightly favor Black may be -1 or lower, and evenly balanced positions are 0.

Using a method called alpha-beta pruning, the engine can ignore sequences of moves that ultimately lead to positions it has already determined are worse than a position it has already found. This makes the search process much more efficient.

After searching all the way to the end of potential sequences, the engine backs up and chooses the move that leads to the position with the highest evaluation.

This move is what the engine recommends as the “best” move for the current player.

Of course, chess engines aren’t perfect. They can’t possibly see every single sequence of moves and position, and their evaluations are limited by how accurately their algorithms can assess complex positions.

But the best engines today have been programmed with sophisticated algorithms and have access to massive databases of master games, allowing them to play at a superhuman level.

Chess Engine Search Techniques

The techniques that chess engines employ include:

Search Depth

Chess engines explore potential moves by “looking” several moves ahead, known as the search depth. The deeper an engine searches, the more accurate its analysis becomes.

However, searching too deeply can slow down the engine and cause it to run out of time in a game. Engines must strike a balance between search depth and speed.

Pruning

To avoid wasting time analyzing poor moves or redundant positions, engines use pruning techniques like:

  • Alpha-beta pruning: Ignores moves that won’t improve the position.
  • Quiescence search: Limits search depth in “quiet” positions with few captures or checks.
  • Transposition tables: Stores positions to avoid re-analyzing them.
  • Null-move heuristic: Skips analyzing responses to an opponent’s “null move”.

Evaluation Functions

An engine evaluates positions using an evaluation function that assesses factors like:

  • Material: Compares the value of the pieces each side has.
  • Mobility: Measures how freely each side’s pieces can move.
  • King safety: Assess each king’s exposure and vulnerability.

The engine chooses the move that leads to the position with the highest evaluation according to these criteria. By tweaking the weights of evaluation functions, programmers can refine an engine’s “style” of play.

Move Ordering

Engines don’t analyze moves in a fixed order. They use heuristics to analyze the most promising moves first. Moves are ordered based on things like:

  • Capture moves
  • Checks
  • Moves suggested by an opening book
  • Moves that have led to good positions in the past

By ordering moves intelligently, engines can find strong moves faster and search deeper. Move ordering, combined with pruning techniques, allows chess engines to play at a superhuman level.

Popular Chess Engines Throughout History

Chess engines have come a long way since the first ones emerged in the 1950s. As computing power has increased, chess engines have become far superior to humans. Let’s look at some of the most well-known chess engines throughout history.

Claude Shannon’s Chess Playing Machine (1949)

One of the earliest chess engines was created by mathematician Claude Shannon. His “chess playing machine” demonstrated the possibility of automating chess.

Mac Hack (1967)

Created at MIT, Mac Hack was developed by Richard D. Greenblatt in the 1960s. It is also known as The Greenblatt Chess Program. Mac Hack VI was the first chess program to play in human tournament conditions, the first to be granted a chess rating, and the first to win against a person in tournament play. 

Deep Blue (1997)

IBM’s Deep Blue made history as the first computer system to beat a chess world champion. In a famous match, Deep Blue defeated Garry Kasparov in a six-game match. Deep Blue could evaluate 200 million chess positions per second, proving that computers had become powerful enough to outplay humans at chess.

Stockfish (2008-present)

One of the top chess engines today is Stockfish, an open-source engine that can beat grandmasters. Stockfish can see an astounding 70 million chess positions per second.

Regular updates have made Stockfish stronger and stronger over the years. As of 2023, Stockfish is ranked as the top engine in the world with an elo rating of >3500.

Concluding Thoughts

So there you have it, a high-level view into the fascinating world of chess engines. These powerful algorithms have revolutionized the game of chess and continue to push the boundaries of artificial intelligence.

Though they still lack the human qualities of intuition, creativity, and positional understanding that the best chess players possess, that inadequacy is covered up by their brute force computational power.

Was this helpful?   Share it with a friend :)
Chessforsharks Editorial Team

hello@chessforsharks.com

Our team comprises a diverse and talented team of writers and chess experts with combined 28 years of experience.

Follow ChessForSharks on social media
  • 7 reasons you lose at chess

    This is just placeholder text. It's just here to fill up space until we have real copy.

    Download
  • join the conversation

    Leave the first comment


    Work With Us

    We help chess brands create engaging and converting content
    We help innovative Chess brands and influencers create content that sparks engagement and drives revenue
    Content WritingContent PromotionContent StrategyContent Optimization

    Subscribe to our Newsletter

    Google reCaptcha: Invalid site key.

    Unlock your chess potential:

    Discover the '7 Reasons You Lose Your Chess Games' in this ebook and elevate your game!

    Google reCaptcha: Invalid site key.

    No spam, ever.

    Once we have your content finalized, we’ll replace this placeholder text with your real content.

    Or Call(123) 456-7890

    Unlock your chess potential:

    Discover the '7 Reasons You Lose Your Chess Games' in this ebook and elevate your game!

    Google reCaptcha: Invalid site key.

    No spam, ever.

    Once we have your content finalized, we’ll replace this placeholder text with your real content.

    Or Call(123) 456-7890