I hope this is an easily answered question, but I am slightly confused about how an evaluation function for a chess game works. I am using a minimax algorithm that evaluates the board at the leaf nodes, taking into account material, piece-square tables, mobility, etc. Does an evaluation function for a minimax algorithm (not negamax) take into account every piece on the board, both black and white, to calculate a board value or does it just look at the pieces of the minimser(black) or maximiser(white).
For instance, do I sum the material of both black and white or just whichever side's turn it is when the evaluate_board() method is called?
I apologise if this is confusing, but I am new to this. Even a little bit of clarification would be much appreciated. Thankyou.
The evaluation of a position can take anything into account. If you use minimax, you might want negative scores to be good for white and postive for black -- or something like that. So if you only use material to evaluate, you could count each white piece as -N
and each black piece as +N
. And the starting position is 0.
Keep in mind that even with pruning, minimax can take a long time if you go even a few ply (depths). So the cheaper or faster the evaluation method is, the better. Simple material advantage IMHO is the only evaluation you'll need.
Of course the chess wiki has a thorough article on the evaluation part of a chess engine: https://chessprogramming.wikispaces.com/Evaluation