Evaluation
The Eval function (or "static evaluator") is responsible for providing a quick assessment of the "score" of a particular position - in other words, which side is winning andby how much. This eval is used by the search to determine the best possible move. Obviously, it is quite difficult to assign an accurate score to a particular position - and absolute accuracy is not really vital (or even possible) in a static evaluator. However, the more accurate the assessment, the better the quality produced by a search of a given depth. Of course, a balance has to be drawn between performance and accuracy; a very simple evaluator which is fast enough to permit a 12-ply search will probably play better than a very sophisticated evaluator which only permits 8-ply searches. It is up to you to determine the balance in your program. Some features which you should consider having in your static evaluator:
- Material - how many pieces does each side have?
- Mills - how many mills does each side have?
- Space and mobility - how much freedom of movement does each side have?
Interestingly, the static evaluator does not need to include tactical ideas like adjoining mills - the search will automatically "discover" these with increasing depth. However, many people put common patterns into their eval to expedite this. Again, it's all about striking the right balance between performance and accuracy - the eval will be called hundreds of thousands (or even millions) of times each move, so performance is vital.