0

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.

Nalyd
  • 95
  • 1
  • 16
  • If you haven't visited https://chessprogramming.wikispaces.com/ before, you can find *lots* of information there. (Probably too much :-). – Bo Persson Mar 15 '18 at 23:45
  • I don't write these kinds of programs, but I would assume that the evaluation method could be as simple or as complex as you desire and need. I would imagine that the very good ones would evaluate all positions, that the better programs would allow for flexible degree of depth of evaluation... – Hovercraft Full Of Eels Mar 15 '18 at 23:46
  • I'm not sure if this is a true programming question though... – Hovercraft Full Of Eels Mar 16 '18 at 00:14

1 Answers1

1

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

Nevermore
  • 7,141
  • 5
  • 42
  • 64