Part IV · Strategy Chapter 27 of 40
How an engine judges a position
An engine gives a number: +0.32, −1.50, +5.00. Behind that number is a sum of terms: material, the placement and mobility of the pieces, the pawn structure, king safety, threats and space. We look at what the evaluation is made of, how it changes towards the endgame, where it goes wrong and what a player at the board can take from it.
What to know first: 8 · Piece values and trades
What you will learn
- understand what an engine's evaluation in pawns means and where it comes from
- name the main terms of the evaluation: material, piece activity, pawns, the king
- see where the static evaluation goes wrong and why the engine needs to calculate
A game on lichess.org, 2014. White has less material: Black is a bishop and two pawns up. But the white queen stands on f5, near the king, and the c2 bishop looks along the diagonal at h7, blocked only by White's own knight on e4. White to move.
White to move, a game on lichess.org, 2014. Find mate in two.
Nf6+: the knight leaves e4 with check and opens the diagonal to h7 for the c2 bishop. Whether Black takes the knight with the pawn, the bishop or the queen, or moves the king to h8, Qh7# follows: the bishop guards the queen on h7. Full game.
If you count only material, White is losing. That is exactly how the part of an engine called the evaluation counts: it looks at the position without making moves. Below is the same position and what stepchess, this course's engine, says about it. Press any row to read what it counts and to see its squares on the board.
The evaluation gives White −4.42: nearly a bishop and a pawn down. It does not see the mate in two, because it does not calculate moves. The mate is found by another part of the engine, the search. In this chapter we look at how both parts work and what of it is useful to a human.
What the number means
The evaluation of a position is a number in pawns. Plus means White is better, minus means Black is better. +1.00 is roughly what an extra pawn is worth. +3.00 is an extra minor piece. An evaluation between −0.30 and +0.30 is equality: one side has small comforts, nothing more.
The number does not tell you how to win. It only says how much better the position is for one side. At +0.50 a game most often ends in a draw or in a win for whoever plays better from there. At +3.00 a strong player almost always wins. At +10.00 there is usually no doubt left: one side is a queen up or has an unstoppable attack.
The engine shows an evaluation of −1.20. What does it mean?
The sign shows the side, the number the size of the advantage in pawns. −1.20 means Black is better by about a pawn. It may be an extra pawn, or a sum of small pluses: better pieces, a safer king, stronger pawns.
Evaluation and search
An engine has two parts. The static evaluation looks at the position like a picture and adds up the terms. The search goes through moves: its own, the opponent's replies, its replies to those, hundreds of thousands of positions. At the end of every line the search asks the evaluation what it thinks of the resulting position, and chooses the move after which, with the best play by both sides, the evaluation will be best. The stepchess evaluation has thirty-one terms, and they fall into seven groups: material, pieces, pawns, the king, threats, space and endgame knowledge.
That is why in the position from the start of the chapter the engine finds Nf6+: the search reaches the position after Qh7#, where the king is mated, and such a line beats any number. The evaluation without search sees only the picture. A human works the same way, by the way: first we judge a position by eye, and then we calculate lines where it is needed.
Try it yourself. The board below shows the starting position, and you move for both sides. Play 1. Nf3, then go back and play 1. Na3. Compare the evaluations: a knight on f3 hits the central squares d4 and e5, while from a3 it hits only b5 and c4.
In the starting position all the terms are equal for the two sides and cancel out, so only material with a zero is left in the list. After a move, rows appear where the sides differ. 1. e4 gives White about +0.32: the pawn has taken the centre and opened the way for the queen and the bishop, and White has more moves. Remember: the rows show only the difference between White and Black. What the sides have equally does not make it into the list.
Material
The main term is material. The engine counts the pieces much as you learnt in the chapter on piece values, only more precisely and differently for the middlegame and the endgame. In the middlegame stepchess values a pawn at 0.82, a knight at 3.13, a bishop at 3.46, a rook at 4.62 and a queen at 10.39. In the endgame a pawn rises to 0.94, a knight drops to 2.82 and a rook rises to 5.46. These numbers were fitted on positions from real games, and they are close to what players know.
Two more terms are added to material. The bishop pair is worth about 0.2 of a pawn: two bishops hold squares of both colours. The material imbalance takes into account that the value of the pieces depends on the pawns: a knight is better in a closed position with many pawns, and a rook in an open one.
Why is a rook worth more to the engine in the endgame than in the middlegame?
A rook needs open lines. In the middlegame pawns and pieces block them, while in the endgame the board empties, and the rook attacks pawns and cuts off the king. A knight, on the contrary, has a harder time in the endgame: it is slow, and pawns can be on both wings.
Pieces: placement and mobility
The second big term is where the pieces stand. The engine keeps a table of squares for each piece: knights and bishops are well placed in the centre, pawns are good when advanced, the king belongs in shelter in the middlegame and in the centre in the endgame. Mobility is counted separately: how many squares the knights, bishops, rooks and queen can reach. Squares hit by the opponent's pawns do not count: the piece may go there, but it will be chased away.
There are also terms for particular pieces. A knight on a pawn-protected square in the opponent's camp gets an outpost bonus. A rook on an open file gets a bonus, and a rook on the seventh rank another one. A bad bishop, shut in by its own pawns, gets a penalty. On the board below the e-file is open. Put a rook on it, Rae1 or Rfe1, and see which row appears.
The row "Rook on an open file" brings White about 0.2 of a pawn, and with mobility the evaluation grows further. Not much? For an engine it is a noticeable difference: an advantage is made of such fractions. Positional play is exactly this: collecting small pluses step by step until there are enough of them for a decisive blow.
Pawns
The third group is the pawn structure. The engine penalises isolated pawns, which have no friends on the neighbouring files, doubled pawns on one file and backward pawns, which cannot safely move forward. It rewards connected pawns standing side by side, pawn chains and passed pawns, whose way is not blocked by the opponent's pawns. A passed pawn is worth more the further it has advanced.
Material here is equal, but the evaluation favours Black. White has three pawns on the queenside, and all of them are weak: the a2 pawn is isolated, the c2 and c3 pawns are doubled and also have no neighbours. Black's a7 and b6 pawns hold together, and b6 and e6 stand on protected squares. White will have to defend every weak pawn with pieces, and those pieces will not play. More on pawns in the chapter on pawn structure.
King safety
The fourth group is the king. In the middlegame the engine values the pawns in front of the king, on the second and third ranks: they shelter it from checks. It penalises open files next to the king and counts the opponent's pieces that hit the squares around it. One such piece is hardly dangerous, but when three or four gather, the penalty grows quickly. Pawns advancing on the opponent's king also get a bonus: they break open the shelter.
The board below shows a symmetrical position from the Italian Game. Both kings have castled and are well sheltered. Push White's g2 pawn to g4 and see what the evaluation says about the white king's cover.
After g4 the cover weakens, and the evaluation drops by almost half a pawn. The engine does not know whether Black will have an attack. It knows only that such pawn moves in front of your own king more often hurt than help. That is a good rule for a human too: do not touch the pawns in front of a castled king without a reason. Look at the other rows too: the g4 pawn has broken away from its neighbours on f2 and h2, so the engine removed the bonus for connected pawns, and the row "Piece placement" has also gone into the minus.
Threats and space
Two smaller groups remain. Threats: a hanging piece that nobody can defend, a piece attacked by a pawn and a double attack. This is the evaluation's attempt to look one move ahead without a search: if a piece is hanging, it will most likely be taken. Space: how many times each side hits the central squares d4, e4, d5 and e5, and how many safe squares it has in its own camp behind its pawns. The more room, the easier it is for the pieces to regroup. Both groups usually give tenths of a pawn, but in closed positions space decides who gets to play.
Middlegame and endgame
The evaluation is built so that every term has two values: one for the middlegame and one for the endgame. The engine looks at how many pieces are left on the board and blends them. At the start of the game the first value works, towards the endgame the second. That is why in the endgame the king goes from "hide it" to "bring it to the centre", and a passed pawn gains in value.
There is only one extra pawn here, but the evaluation is +1.60. Besides material, White gets credit for the passed pawn and for the active king: it stands in front of the pawn, while the black king is far from it. White wins this position. Look at the row "King activity": in the middlegame this term hardly exists.
Where the evaluation goes wrong
The static evaluation is a set of rules, and rules have exceptions. In the position from the start of the chapter it did not see the mate. In the endgame it can take a draw for a win. Look at the position below.
White to move. The static evaluation gives White +1.23. How does this position end with correct play?
The kings face each other, and it is White to move: Black has the opposition. The white king cannot get forward, and the pawn alone will not queen. The evaluation sees an extra pawn and a passed one, but not the opposition. The engine with search and endgame tables shows 0.00 here.
That is why an engine never relies on the evaluation alone. The search checks its rules with moves: if a queen is lost or a mate is given in some line, the search will see it. And for positions with few pieces the engine has endgame tables, where the result is known exactly. Here is one more position where White is a rook down and the evaluation gives them −3.08, but the search finds mate.
White to move, a game on lichess.org, 2014. Black is a rook up. Find mate in two.
Nh6+: a double check, by the knight and the b3 bishop. Against a double check the only defence is a king move: …Kh8. The f8 rook is no longer defended by the king, and Rxf8#. Full game.
What to take for yourself
A human cannot add up thirty terms in their head, and does not need to. It helps to keep four questions in mind, in the same order the engine counts them. What is the material? Where do the pieces stand, and which of them have nothing to do? Which pawns are weak and which are passed? How safe are the kings? Once you answer them, you will understand who is better and find what to improve: the worst piece, the weakest pawn, your king's shelter. The worst piece is a good candidate for the next move: bring it to where it will have more squares and more work.
The engine's evaluation on the analysis page is worth trusting, and also worth checking. If the engine shows +1.50 and you do not understand why, make its first move and look at the new position: often the reason is tactics that the search sees. If the reason is positional, look for it among the same four groups.
Material is equal, but the engine gives White +0.80. Where should you look for the reason first?
If material is equal, the advantage is made of the other groups: White's pieces are more active, Black has weak pawns or a weakened king. Sometimes the reason is tactics that the search sees: then the engine's first move will show it.
What's next
Of the four groups of the evaluation, the most lasting is the pawns. Pieces move from square to square, but a pawn cannot go back, and a weakness in the pawn structure stays until the end of the game. That is the subject of the next chapter.