1/30/2013

About evaluation

The evaluation function is very important, because in most cases, the search must be terminated before the game ends in a checkmate or draw. One way to think about the evaluation function is that it indicates the probability that one side is winning. Assuming perfect play, there is no chance in chess as such. If we had enough computing power, it would be possible to say with absolute certainty for each position if it is a draw or win for white or win for black. But we do not have that power, so we have to resort to the heuristic approach.

Most of the commercial chess engines use pawns as the basic unit of evaluation. Everything else being equal, but white has one pawn more, yields the score +1.00. Similarly, if black is up a pawn, the score is -1.00. For a grandmaster, one pawn advantage is usually just enough to win the game. And if the score equals zero, the position is a dead draw. On the other hand, checkmates result in evaluation at infinity. In practice, chess engines use finite, but such a big number for checkmates that it cannot be confused with other evaluations.

The evaluation function is where most of the expert knowledge in a chess engine is located. Evaluating chess positions is difficult even for experienced human players. It is not possible to invent straightforward rules that apply to every position. Usually what separates a good player from a really strong player is the specific knowledge of different types of positions and which plans work in them. It is possible to program some of this information in a chess engine, but human beings and computers think in a different way, making this a difficult task.

One theory of evaluation is based on three factors: material, space, and time. The player with more material is usually more likely to win. The players with more space is also more likely to win, because he has more options to manouver his pieces. And third, the player who is ahead of the other one in development or has the initiative, is more likely to win. In addition, there are factors like pawn structure, piece mobility, and king safety. These are often explained through the three factor model (material, space, time), but I think the model is not that well-suited for computer chess as it is for human players.

I suggest a different model for the evaluation in a chess engine. It is also based on three concepts, but these are different from the previously presented. They are: force, path, and targets. Force is approximately equal to material. It refers to the pieces and their latent values. Path means that the pieces have routes on the board. It is close to the concept of space, but it is more specific to the piece type. What is a path to a knight is not usually a path to a bishop. And finally, targets refer to weak or otherwise important points in the opponent's position. These are related to the path and force so that the force strikes the targets via the path. If one of these factors is missing, then the strike cannot succeed.

First, the force or material, is evaluated by using a simple piece value table:

PieceValue
Pawn1.00
Knight3.25
Bishop3.25
Rook5.00
Queen9.75
KingInfinity
Bishop pair0.50

This is a refined version of the traditional 1-3-3-5-9-scoring. It includes a bonus for the side with the bishop pair, because it is widely recognized at grandmaster level that a pair of bishops is slightly better than a bishop and a knight or two knights.

Paths are calculated backwards from the targets. Paths may mean open or semi-open files for rooks or diagonals for bishop. For knights it may mean outposts squares. For passed pawns it may mean free path to the promotion square.

As already mentioned, a target is a weak or important point in the opponent's position. Weak points include e.g. isolated and backward pawns. Important points include the central squares, bases of pawn chains, and squares near the king. These lists are not exclusive, but may be extended as new factors affecting the position become obvious.

This is an initial attempt to evaluate the position. A more sophisticated function can be implemented when the chess engine is otherwise working fine.

No comments:

Post a Comment