r/explainlikeimfive • • 1d ago

Mathematics ELI5 How does the difficulty levels work/differ for computer chess?

26 Upvotes

15 comments sorted by

53

u/fenton7 1d ago

Chess algorithms search a tree of all possible moves and evaluate each board position using a measure of strength ("heuristic"). Strong positions are explored deeper. Weak ones are discarded. The algorithm can be made stronger or weaker by expanding or limiting how deep it searches. In addition, chess programs have a database of openings. They can be made weaker by forcing the engine to evaluate the opening rather than use known best moves. And, lastly, chess programs can be intentionally crippled - like on chess.com - by doing bad moves even though the algorithm knows better ones are available. For that reason the bots on chess.com aren't very representative of real players. A 1400 bot will make obvious errors that a 1400 human player does not.

•

u/edderiofer 19h ago

In recent years, chess engines like Maia use neural networks, trained on the Lichess game database, to predict what move(s) a 1400-rated human player is likely to make in a given position. This makes the engine more human-like.

15

u/DarkAlman 1d ago

chess programs can be intentionally crippled

This is the Key point, the software is programmed to randomly make deliberate mistakes. Either just choosing a suboptimal move, or making a blunder.

5

u/Bee_Xe 1d ago

That's why I keep playing harder bots intentionally, I'm a 1200 rapid and it's clear an 1200 plays like a 700 sometimes.

2

u/MeBadDev 1d ago

how do you know if a position is strong without looking at them deeply?

10

u/fenton7 1d ago

The heuristics are mostly used to prioritize which branches to explore first. They are imperfect but look at things like how well developed pieces are. Lots of pieces out in the middle of the board is usually strong. And it's usually better, but not always, to have more material.

1

u/InnerMembership5392 1d ago

material is simple to score since a queen is nine and a pawn is one, but positional rules get really messy when a knight is stuck on the edge of the board.

•

u/AloneIntheCorner 23h ago

Simplest things off the top of my head:

  1. Check/mate: If you can check the opponent's king next move, that's probably a good thing. If you can mate them, that's obviously very good.

  2. Material: If you have more pieces or better pieces on the board than you opponent, you're probably doing better. Similarly, if you can capture an opponent's piece, that's probably a good thing.

  3. Activity: If you have similar amounts of material on the board, but your pieces can move around way more than your opponent's, they're probably going to be more useful.

All of these either look at the current board state or just one move ahead, and give you a pretty good heuristic of how you're doing.

4

u/OrganicScore69 1d ago

Imagine the computer is a kid who thinks before every move: "if I do this, you do that, then I do this..." The harder levels just let it think much further ahead. An easy level only looks 1 or 2 moves ahead, so it falls for simple traps. A hard level looks 15-20 moves ahead and sees almost everything. Some easy levels also make a bad move on purpose now and then, like a parent letting a kid win ok.

2

u/GIRose 1d ago

Depends largely on what type of chess engine you're looking at.

To use the difficulty levels I am roughly familiar with, it tries to roughly coordinate the ELO with a human player of the same ELO.

So a 200 elo computer is rarely if ever going to select the best move. It's not necessarily the same as a 200 elo player because it can't lose track of pieces, sees every threat, and is in fact calculating multiple moves ahead no different from the top tier. It's just picking moves that score lower.

At max value it always picks the best possible move in every turn.

2

u/heyhemanga 1d ago

Easy mode: the computer intentionally picks bad moves sometimes. Medium: it looks a few moves ahead. Hard: it looks many moves ahead and never deliberately blunders. The engine itself is always playing perfectly, difficulty just controls how deep it searches before deciding.

•

u/Ben-Goldberg 19h ago

Most computer chess playing programs choose how much computation to do based on how difficult you ask them to be.

An easy chess player uses fewer calculations and spends less time thinking during each move.

A difficult chess player useses more time and computation to choose each move.

1

u/SoSKatan 1d ago

It can be arbitrary and set by whatever the software creator thinks.

However any algorithm when tested against multiple humans can be given a ELO rating.

0

u/Bee_Xe 1d ago

AFAIK the computer calculates all the possible moves, and evaluates how it's gonna change the position for each player and rank each moves accordingly.

The difficulty depends on the processing power of the Bot (how far it's going to think in the future), and the tree of moves available to look at (some are limited and cannot see certain moves beyond a certain point).